C# Basic Questions develop windows form applications in c sharp lenguage

C# Basic Questions

C# Basic Questions

 

C# Basic Questions

In this article, we are going to say about the most C# Basic Queries.

1. Write a C# Sharp program to print Hello and your name during a separate line.

Expected Output:

Hello: Ashraf

2. Write a C# Sharp program to print the sum of 2 numbers.

3. Write a C# Sharp program to print the result of dividing 2 numbers.

4. Write a C# Sharp program to swap 2 numbers.

Test Data:

Enter the First Number: 5

Enter the Second Number: 6

Expected Output:

After Swapping :

First Number: 6

Second Number: 5

5. Write a C# Sharp program to print the output of multiplication  3 numbers that will be entered by the user.

Test Data:

Enter the first number: 4

Enter the second number: 1

Enter the third number: 6

Expected Output:

4 x 1 x 6 = 24

6. Write a C# Sharp program to print the output of multiplying, dividing, adding and subtracting of 2 numbers which can be entered by the user.

Test Data:

Enter the first number: 12

Enter the second number: 3

Expected Output:

12 x 3 = 36

12 / 3 = 4

12 +3 =15

12 – 3  = 8

12 % 3 =0

7. Write a C# Sharp program that will take a number as input and print  the table of its multiplication.

Test Data:

Enter the number: 5

Expected Output:

5 * 0 = 0

5 * 1 =5

5 * 2 = 10

5 * 3 = 15

.
.
.
.
.

5 * 10 = 50

8. Write a C# Sharp program that will take  4 numbers as input to calculate the average

Test Data:

Enter the First number: 2

Enter the Second number: 3

Enter the third number: 6

Enter the four number: 7

Expected Output:

The average of 2, 3, 6, 7 is: 4.5

9. Write a C# Sharp program that will take 3 numbers(x,y,z) as input and print the output of (x+y).z and x.y + y.z.

Test Data:

Enter the first number: 5

Enter the second number: 6

Enter the third number: 7

Expected Output:

The Result of specified numbers 5, 6 and 7, (x+y).z is 77 and x.y + y.z is 72

10. Write a C# Sharp program that will take an age (for example 20) as input and print something as “You look older than 20”.

Test Data:

Enter your age: 25

Expected Output:

You look older than 25

11. Write a C# program that takes a number like input and show it four times in a row (separated by blank spaces), and then four times in the next row, with no separation. You should do it two times: Use Console. Write and then use {0}.

Test Data:

Enter a digit: 25

Expected Output:

25 25 25 25

25252525

25 25 25 25

25252525

12. Write a C# program which will take a number as input and so on appear a rectangle of 3 columns wide and 5 rows tall using that digit.

Test Data:

Enter a number: 5

Expected Output:

555

5 5

5 5

5 5

555

13. Write a C# program to convert from celsius degrees to Kelvin and Fahrenheit.

Test Data:

Enter the amount of celsius: 30

Expected Output:

Kelvin = 303

Fahrenheit = 86

14. Write a C# program delete specified a character from a non-empty string by use index of a character.

Test Data:

A3shraf

Sample Output:

Ashraf

A3shraf

3Ashraf

15. Write a C# program to make a new string from a given string where the first and last characters will modify their positions.

16. Write a C# program to make a new string from a given string (length one or additional ) with the first character added at the front and back.

Sample Output:

Input a string: The fast brown fox jumps over the lazy dog.

The fast brown fox jumps over the lazy dog.T

17. Write a C# program to take a string from the user then cut the first 3 letters.

18. Write a C# program to take a string from the user then look for the letter A and come return its position and print it on screen.

19. Write a C# program to get absolutely the value of the difference between 2 given numbers. Return double the absolute value

20. Write a C# Program within which the console screen color is blue and also the text color is red and print the sentence “This is that the last question!”

We are therefore finished presenting C# Basic queries . ..

 

 

 

To read more articles like this visit Eduengteam.com

You can find more useful tutorials at Click Here