Postingan

Menampilkan postingan dengan label Csharp

How to View Source Code of .NET EXE

Gambar
How to View Source Code of .NET EXE .NET one of the most familiar word for developers/programmers and CS/IT students. Many of you want to see .NET source code, so if you one of them then try simple methods and view Source code . By following below steps you can get actual C ++ or C # code of any .NET exe with decompiling .NET exe file easily. Step by Step procedure for .NET EXE Source Code: When we are working in .NET and want to compile and application code which written in C++ or C#, then after compiling and develop we get and exe file of .NET. Now what will you do when you want get back the source code of C++ or C# application. In simple words it is called decompiling of the .NET application. There are many tools use for decompile it. For this you just need to put .NET exe which is created using .NET now decompiler will give you the source code which written in C++ and C#. So now its also considered the security risk and also raise the point that we should secure our .NET exe b...

C# Program to find Area of Triangle

C# Program to find Area of Triangle Program Statement: If the lengths of the sides of a triangle are denoted by a, b, and c, then area of triangle is given by Area = S?S(S-a)(S-b)(S-c) where, S = ( a + b + c ) / 2 Solution: class sq { int a, b, c; double S, Area, temp2; public double s(double t) { double lb = 0, ub = t, temp = 0; int count = 50; while (count != 0) { temp = (lb + ub) / 2; if (temp * temp == t) { return temp; } else if (temp * temp > t) { ub = temp; } else { lb = temp; } count--; } return temp; } public void cal() { Console.Write("\n\t\tEnter value of a : "); a = Convert.ToInt32(Console.ReadLine()); Console.Write("\n\t\tEnter value of b : "); b = Convert.To...

C# Program for Array solving problems

C# Program for Array solving problems Program Statement: Write a function which takes four arrays of same size as arguments; array1, array2, array3, array4. The function will multiply the corresponding values of array1 and array2 and will save the result at same index of array3. i.e. array3[0] = array1[0] * array2[0] and so on. Then create another function and pass all four arrays to that function as argument where you have to compare array1, array2 and array3 and save the max value in array4 i.e. if array1[0] = 10, array2[0] = 5, array3[0]= 11 then you have to save max value i.e. array4[0] = 11. In main function, show all values of array4. Solution: class _arr { public void mul(int n, int[] array1, int[] array2, int[] array3) { for (int i = 0; i < n; i++) { array3[i] = array1[i] * array2[i]; } Console.Write("\nArray3 = Array1 * Array2 : "); for (int i = 0; i < n; i++) ...

C# Main Function for Calling all classes

C# Main Function for Calling all classes void Main_Fun() { int num; Program obj = new Program(); Console.Clear(); Console.ForegroundColor = ConsoleColor.Green; Console.BackgroundColor = ConsoleColor.DarkCyan; Console.WriteLine("\n\t\t\t*****VISUAL PROGRAMMING*****"); Console.WriteLine("\n\t\t\t ****ASSIGNMENT # 1****\n\n"); Console.Write("\nIf Run Project (Y/N) ? "); obj.choice = Convert.ToChar(Console.ReadLine()); if (obj.choice != 'Y' && obj.choice != 'y') { Console.WriteLine("\nSee you Next Time"); } else { Console.Write("\nEnter the Question No. : "); num = Convert.ToInt32(Console.ReadLine()); switch (num) { case 1: ...

C# Program to find Student GPA and CGPA || Concept of ENUM in C#

C# Program to find Student GPA and CGPA Program Statement: Create a class of student which stores characteristcs of student like studentID, studentName, studentDOB, studentRollNo, studentEmail, studentGPA of last 5 semesters and other related information of the student. (You may set some properties Boolean and some readonly) a. Calculate the CGPA of each student using function calculateCGPA(…). b. Student with highest CGPA will be considerd CR of the class. There should be a function which will compare the CGPA of students and will declare a student having greater CGPA as CR. c. Program should be able to take input of 5 students from user; definitely there will be a function which will take input from the user. d. You have to use the Setter for setting the values of the data members of the class and and Getter function for getting the values of the data members of the class. (You can use property as alternative) e. Default value for each student GPA should be 3.0. (You have to use an a...

C# Program which calculated factorial to prime function

C# Program which  calculated factorial to prime function Program Statement: Write two functions max(int,int) and prime(int). max function will take two arguments and will return the maximum of two numbers in main. Then main function will pass this calculated factorial to prime function which will show that passed value is prime or not. Solution : public class _max { public int max(int a, int b) { if (a > b) return a; else return b; } public void prime(int n) { if (n == 1) Console.WriteLine("\n\t\t{0} is maximum but not prime number!\n\n", n); if (n >= 2) { if (n % 2 != 0) { Console.WriteLine("\n\t\t{0} is maximum and Prime number!\n\n", n); } else { Console.WriteLine("\n\t\t{0} is maximum but not a Prime nu...

C# Program to solve different problems

C# Program to solve different problems Program Statement: Write a program which will take input a character ‘a’ value from user. You have to use switch statement to decide if value of a is ‘t’ then you have to call table function, if value of a is ‘f’ then call factorial function, if value of a is ‘p’ then call prime function, if value of a is ‘s’ then call search function. You have to write four functions in your program; Table(int n1,n2) Factorial(int n3) Prime(int n4) Search(char n5[], char c, char choice) Table function will print the table of n1 from 1 to n2. Factorial function will print the factorial of n3 if n3 is multiple of 2. Prime function will print the n4 if n4 is prime. Search function will take first argument n5 as an array of characters and second element a character to be search in the array and third element a character to decide which searching algorithm to be used.i.e. if user has passed the value of c as ‘s’ then Search function will perform the sequential search ...

C# Program which takes n values from user and then sort them using Bubble sort

C# Program which takes n values from user and then sort them using Bubble sort Program Statement: Write a program which takes n values from user and then sort them using Bubble sort Solution: public class bubble { int n, x, y, z; public void sort() { System.Console.Write("\n\t\tEnter length of array : "); n = Convert.ToInt32(System.Console.ReadLine()); int[] array = new int[n + 1]; int[] temp1 = new int[n + 1]; int[] temp2 = new int[n]; System.Console.WriteLine("\n\t\tEnter {0} numbers : ", n); for (x = 0; x < n; x++) { array[x] = Convert.ToInt32(System.Console.ReadLine()); } for (y = n; y > 0; y--) { for (z = 0; z < y; z++) { if (array[z] > array[z + 1]) { temp1[z] = array[z]; ...

C# Program which takes n values from user and then sort them in ascending order

C# Program which takes n values from user and then sort them in ascending order Program Statement: Write a program which takes n values from user and then sort them in ascending order . Solution: public class sort { int n, x, y, z; public void s() { Console.Write("\n\t\tEnter number of values you want to sort : "); n = Convert.ToInt32(Console.ReadLine()); int[] arr = new int[n]; for (int i = 0; i < n; i++) { Console.Write("\n\t\tEnter number : "); arr[i] = Convert.ToInt32(Console.ReadLine()); } for (x = 0; x < n; x++) { for (y = x + 1; y < n; y++) if (arr[x] > arr[y]) { int temp; temp = arr[y]; arr[y] = arr[x]; arr[x] = temp; } ...

C# Program to Print number of prime values in the array

C# Program to Print number of prime values in the array Program Statement: Write a program which takes 10 values from user in an array and then show the number of prime values in the array. Solution: public class arr { int c, count = 0, n; int[] array = new int[10]; public void arr_func() { Console.WriteLine("\n\t\tEnter 10 element only!\n"); for (int x = 0; x < 10; x++) array[x] = Convert.ToInt32(Console.ReadLine()); for (int y = 0; y < 10; y++) { n = array[y]; for (c = 2; c <= n - 1; c++) { if (n % c == 0) { break; } } if (c == n) { count++; Console.WriteLine("\n\t\t{0} is prime number!\n", n); } } Console.WriteLine("\n\t\tNumber of prime values : {0}\n", count); } }

Convert C Coding into C# Coding without using goto Statement

Convert C Coding into C# Coding without using goto Statement Program Statement: How many printf statements will be executed by this program and rewrite the following program without using goto statement . void main( ) { int i, j, k ; for ( i = 1 ; i <= 3 ; i++ ) { for ( j = 1 ; j <= 3 ; j++ ) { for ( k = 1 ; k <= 3 ; k++ ) { if ( i == 3 && j == 3 && k == 3 ) goto out ; else printf ( "%d %d %d\n", i, j, k ) ; } } } out : printf ( "Out of the loop at last!" ) ; } Solution: public class _check { int i, j, k, check=0; public void c() { for (i = 1; i <= 3; i++) { for (j = 1; j <= 3; j++) { for (k = 1; k <= 3; k++) { if (i == 3 && j == 3 && k == 3) { Console.WriteLine("\n\t\tOut of the loop at last \n");...

C# Program should be able to search a value in the array using binary search algorithm

C# Program which takes n values in an array and then program should be able to search a value in the array using binary search algorithm Program Statement: Write a program which takes n values in an array and then program should be able to search a value in the array using binary search algorithm. Hint: You have to sort that array first because binary search can be applied only on sorted array Solution: public class search { int n, num, s = 1, e, mid; public void show() { Console.Write("\n\t\tEnter length of array : "); n = Convert.ToInt32(Console.ReadLine()); int[] array = new int[n]; Console.WriteLine("\n\t\tEnter {0} numbers : ", n); for (int i = 0; i < n; i++) { array[i] = Convert.ToInt32(Console.ReadLine()); } for (int x = 0; x < n; x++) { for (int y = x + 1; y < n; y++) { ...

Array Problem Solving using C#

Array Problem Solving using C# Program Statement: Create two arrays student_rollno and student_marks, both of same size. First array will save the rollnos of students and second array will save the marks of students against his rollno. e.g. if student_rollno[0] contains 197 then student_marks[0] will contains the marks of roll no 197. You have to print the roll no of student with maximum marks. Solution: public class stud { int n, max = 0, check = 0; public void marks() { Console.Write("\n\t\tEnter number of students : "); n = Convert.ToInt32(Console.ReadLine()); int[] array1 = new int[n]; int[] array2 = new int[n]; for (int x = 0; x < n; x++) { Console.Write("\n\t\tEnter Roll No : "); array1[x] = Convert.ToInt32(Console.ReadLine()); Console.Write("\n\t\tEnter Marks : "); array2[x] = Convert...

C# Program which copies the values of one array in second array in reverse order

C# Program which copies the values of one array in second array in reverse order Program Statement: Write a program which copies the values of one array in second array in reverse order Solution: public class reverse { int n; public void rev() { Console.Write("\n\t\tEnter length of array : "); n = Convert.ToInt32(Console.ReadLine()); int[] arr1 = new int[n]; int[] arr2 = new int[n]; Console.WriteLine("\n\t\tEnter {0} numbers : ", n); for (int x = 0; x < n; x++) { arr1[x] = Convert.ToInt32(Console.ReadLine()); } Console.Write("\n\t\tReversed element : "); for (int y = n - 1; y >= 0; y--) { arr2[(n - 1) - y] = arr1[y]; } for (int z = 0; z < n; z++) { Console.Write(" {0}", arr2[z]); } Console.WriteLine("\n"); } }

C# Program using Functions and loops

C# Program using Functions Program Statement: Write a function which takes one value as parameter and display the sum of digits in the value. e.g. if user has passed 125 then function will print 1+2+5 = 7 Solution: class _sum { long n, i, sum = 0; public void add(long n) { for (i = n; i != 0; i = i / 10) { sum = sum + i % 10; } Console.WriteLine("\n\t\tSum of digits is : {0}", sum); } public void input() { Console.Write("\n\t\tEnter desired digit : "); n = Convert.ToInt64(System.Console.ReadLine()); add(n); } }

C# Program using Two argument passing function

C# Program using Two argument passing function Program Statement: Write a function which takes two values n1 and n2 as arguments and multiply the n1 by itself n2 times i.e. calculate n1n2 and then return the result to main function which will display the result. Solution : class power_fun { double x; public power_fun() { x = 1; } double power(int a,int b) { for (int i = 1; i <= b; i++) { x = x * a; } return x; } static void Main(string[] args) { power_fun p = new power_fun(); int n1, n2; double result; Console.Write("Enter 1st Value: "); n1 = Convert.ToInt32(Console.ReadLine()); Console.Write("Enter 2nd Value: "); n2 = Convert.ToInt32(Console.ReadLine()); result= p.power(n1, n2); Console.Write...

C# Program to Print half Diamond shapes using numbers

C# Program to Print half Diamond shapes using numbers 1 to 10 Program Statement: Write a program to produce the following output:              1           2   3         4   5   6        7  8  9  10 Solution: static void Main(string[] args) { int i,j,k=1; for (i = 1; i <= 4; i++) { for (j = 4; j >= 1; j--) { if (j > i) Console.Write(" "); else Console.Write(" " + k++ + " "); } Console.WriteLine(); Console.WriteLine(); } Console.ReadLine(); }

C# Program to display the different series output on the screen

C# Program to display the different series output on the screen Program Statement: Write a program which display the following output on the screen. 1 2 3 4 5 1 4 9 16 25 1 8 27 64 125 Solution: static void Main(string[] args) { for (int i = 1; i <= 5; i++) Console.Write(i+" "); Console.WriteLine(); for (int i = 1; i <= 5; i++) Console.Write(i * i+" "); Console.WriteLine(); for (int i = 1; i <= 5; i++) Console.Write(i * i * i+" "); Console.ReadLine(); }

C# Program to Print Triangle in Square

C# Program to Print Triangle in Square Program Statement: Write a program which display the following output on the screen. ####$#### ###$#$### ##$###$## #$#####$# $#######$ Solution: class shape { int x, y; public void sh() { Console.WriteLine(); for (x = 1; x <= 5; x++) { for (y = 1; y <= 5 - x; y++) { Console.Write("#"); } Console.Write("$"); for (y = 2; y <= x * 2 - 1; y++) { Console.Write("#"); } Console.Write("\b$"); for (y = 1; y <= 5 - x; y++) { Console.Write("#"); } Console.WriteLine("\n"); } } }

C# Program to Print Triangles

C# Program to Print Triangles Program Statement: Write a program to produce the following output: A B C D E F G F E D C B A A B C D E F     F E D C B A A B C D E           E D C B A A B C D                 D C B A A B C                        C B A A B                               B A A                                      A Solution: static void Main(string[] args) { int a, x, n = 71, o = 70, y = 1, c; for (x = 1; x <= 7; x++) { for (a = 65; a <= n; a++) { Console.Write(Convert.ToChar(a)); } if (x == 2) o = 70; for (c = ...