As last year i share all Programs of Assembly language which i study in last Semester Now in this semester i am on C# programming learning it practicing it so i want to share all my programs of C# which are coded by me,so i am going to share that programs so that other peoples also got benefit from them and don't hesitate to discuss C# programming with me as you all discuss a lot  C and C++ languages which we studied last year.

C# programs List:

Problem#1:

Write a program which converts the 1 lower case letter (‘a’ – ‘z’) in its corresponding upper case letter 
(‘A’ – ‘Z’). E.g. if user enter c then program will show C on the screen.

Problem#2:

Write a program which takes three points (x1, y1), (x2, y2) and (x3, y3) from user and program will check if all the three points fall on one straight line or not.
View Solution

Problem#3:

Write a program which takes coordinates (x, y) of a center of a circle and its radius from user, program will determine whether a point lies inside the circle, on the circle or outside the circle.

Problem#4:

Write a program which take one character from user and determine whether the character entered is a capital letter, a small case letter, a digit or a special symbol. The following table shows the range of ASCII values for various characters.
Character
ASCII Values
A – Z
A – z
0 – 9
Special symbols
65 – 90
97 – 122
48 – 57
0 – 47, 58-64, 91-96,123-127
View Solution

Problem#5:

Write a program using switch statement which takes one value from user and ask about type of conversion and then will perform conversion according to type of conversion.if user enters
I -> convert from inches to centimeters.
G -> convert from gallons to liters.
M -> convert from mile to kilometer.
P -> convert from pound to kilogram.
If user enters any other character then show a proper message.
View Solution

Problem#6:

In a company, worker efficiency is determined on the basis of the time required for a worker to complete a particular job. If the time taken by the worker is between 2 – 3 hours, then the worker is said to be highly efficient. If the time required by the worker is between 3 – 4 hours, then the worker is ordered to improve speed. If the time taken is between 4 – 5 hours, the worker is given training to improve his speed, and if the time taken by the worker is more than 5 hours, then the worker has to leave the company. If the time taken by the worker is input through the keyboard, find the efficiency of the worker.
View Solution

Problem #7:

Write a program using conditional operators to determine whether a year entered through the keyboard is a leap year or not.
View Solution

Problem #8:

Write a program using switch statement which takes one character value from user and check whether the entered value is arithmetic operator, logical operator, conditional operator, relational operator or something else.
View Solution

Problem #9:

Write a program which prints an identity matrix using for loop i.e. takes value n from user and show the identity table of size n * n.
View Solution

Problem #10:

Write a program using for loop which prints the following series.
1 2 4 8 16 21 64 128 …nth iteration
View Solution

Problem #11:

Write a program using for loop which prints the following output. (You have to find a pattern to print alphabetics in this order)
A B D H P
View Solution

Problem #12:

Write a program using loop which prints the following output.
1 2 2 3 3 3 4 4 4 4 5 5 5 5 5 6 6 6 6 6 6 . . . nth iteration
View Solution

Problem #13:

Write a program to print all the ASCII values and their equivalent characters using a while loop. The ASCII values vary from 0 to 255.
View Solution

Problem #14:

Write a program which takes characters from user until user press ENTER and then program will show the number of words with length greater than or equal to 5.
View Solution

Problem #15:

Write a program to print all the ASCII values and their equivalent characters using a do-while loop. The ASCII values vary from 10 to 255.
View Solution

Problem #16:

Write a program which takes one value from user and check whether the entered value is character, integer or special symbol.
View Solution

Problem #17:

Write a program that takes an integer as an input from user and prints if it is a prime or composite number.
View Solution

Problem #18:

Write a program which prints the Fibonacci series using loop.
1 1 2 3 5 8 13 21 34 …
View Solution

Problem #19:

Write a program using for loop which prints the following output on the screen.
*
**
***
****
***
**

Problem #20:

Write a program using for loop which prints the following output on the screen.
*
***
*****
*******
*********
***********
View Solution

Problem #21:

Write a program to print out all Armstrong numbers between 1 and 500. If sum of cubes of each digit of the number is equal to the number itself, then the number is called an Armstrong number. For example, 153 = (1 * 1 * 1) + (5 * 5 * 5) + (3 * 3 * 3)
View Solution

Problem #22:

Write a program using for loop which prints the following output on the screen.
$$$$$$$$$$$

$                $

$                $

$                $

$$$$$$$$$$$
View Solution

Problem #23:

Write a program using loop which takes one value n from user and show the factorial of all prime numbers which are less then n. e.g. if n = 10 then program will print the factorial of 2,3,5,7.
View Solution

Problem #24:

Write a program to display the sum of the following series using loop.
1*x + 2*x2 + 3*x3 + 4*x4 + 5*x5 + … + n*xn
View Solution

Problem #25:

Write a program to display the sum of the following series i.e. sum of the factorial of odd series
1! + 3! + 5! + 7! + 9! + . . . + n!
View Solution

Problem #26:

Write a program to display the sum of the following series.
2/1! + 4/3! + 6/5! + 8/7! + 10/9! + . . . + n/(n-1)!
View Solution

Problem #27:

Write a program to display the sum of the following series i.e. sum of the factorial of odd series multiply with x where power of x is square of corresponding number.
X1*1! + X9*3! + X25*5! + X49*7! + X81*9! + . . . + Xn2*n!
View Solution

Problem #28:

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
View Solution

Problem #29:

Write a program which display the following output on the screen.
####$####
###$#$###
##$###$##
#$#####$#
$#######$
View Solution

Problem #30:

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
View Solution

Problem #31:

Write a program to produce the following output:
             1
          2   3
        4   5   6
       7  8  9  10
View Solution

Problem #32:

Write a program which takes 10 values from user in an array and then show the number of prime values in the array.
View Solution

Problem #33:

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!" ) ;

Problem #34:

Write a program which takes n values from user and then sort them in ascending order.
View Solution

Problem #35:

Write a program which takes n values from user and then sort them using Bubble sort.
View Solution

Problem #36:

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.
View Solution

Problem #37:

Write a program which copies the values of one array in second array in reverse order.
View Solution

Problem #38:

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.
View Solution

Problem #39:

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.
View Solution

Problem #40:

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.
View Solution

Problem #41:

Write a program which will take input a charater ‘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 but if value of c is something else then Search function will perform binary search.
Structure of your program will be like this. You have to make it exactly working.
Switch(a)
{
case ‘f’:
factorial();
break;
case ‘p’:
prime();
break;
case ‘t’:
table();
break;
case ‘s’:
search();
break;

Problem #42:

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.
View Solution

Problem #43:

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.
View Solution

Problem #44:

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
View Solution

Problem #45:

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 array for storing GPAs of last 5 semesters. You may simply initialize the array with 3.0 in constructor).
f. All data members should be private.
g. Member functions can be public.
h. Program must be able to add two objects i.e. if we add two students then all their corresponding data members will be added one by one. (Operator Overloading).
i. Program must contain explicitly definition of copy constructor.
j. StudentID and StudentGPA of last 5 semesters must be constant or readonly.
k. Value of studentGPA of last 5 semesters must be selected from ENUM which may contain values {1.0, 2.0, 3.0, and 4.0}.
View Solution

Main Function for Calling ALL Program Classes
static void Main(string[] args)
        {
            Program obj = new Program();
            obj.Main_Fun();
            Console.ReadKey();

        }

Post a Comment

  1. All Examples Are Very Good.. Thanks Admin

    ReplyDelete
  2. Write an Assembly language Program to take a character between 0-9.
    Sample Solution:
    Enter a number between 0-9.: 8
    Do you want to enter another number?: Y
    Enter a number between 0-9.: c
    Not a number.

    ReplyDelete
  3. Suppose AL and BL contains signed numbers. Put the Biggest one in CL and
    display it.

    ReplyDelete
  4. Write an assemble code for the following pseudo code. (Hint: Take two inputs
    at run time less than 10.)
    If (AL < BL)
    Then
    If (BL < CL)
    Then
    Put 0 in AL and display it
    Else
    Put 1 in BL and display it
    End _if
    End_if

    ReplyDelete
  5. If (AL > BL)
    Then
    SUB AL from BL and display the result
    Else
    ADD AL and BL and display the result.
    End _if

    ReplyDelete

 
Top