1.
Write a C# Sharp program to print Hello and your name in a
separate line.
6. Write a C# Sharp program to print the output of
Expected Output : multiplication of three numbers which will be entered by the
user.
Hello: Alexandra Abramov
Test Data:
Input the first number to multiply: 2
2. Write a C# Sharp program to print the sum of two numbers.
Input the second number to multiply: 3
Input the third number to multiply: 6
3. Write a C# Sharp program to print the result of dividing two
numbers. Expected Output:
2 x 3 x 6 = 36
4. Write a C# Sharp program to print the result of the specified
operations.
7. Write a C# Sharp program to print on screen the output of
Test data: adding, subtracting, multiplying and dividing of two numbers
which will be entered by the user.
-1 + 4 * 6
Test Data:
( 35+ 5 ) % 7
Input the first number: 25
14 + -4 * 6 / 11
Input the second number: 4
2 + 15 / 6 * 1 - 7 % 2
Expected Output:
Expected Output:
25 + 4 = 29
23
25 - 4 = 21
5
25 x 4 = 100
12
25 / 4 = 6
3
25 mod 4 = 1
5. Write a C# Sharp program to swap two numbers.
8. Write a C# Sharp program that takes a number as input and
Test Data: print its multiplication table.
Input the First Number : 5 Test Data:
Input the Second Number : 6 Enter the number: 5
Expected Output: Expected Output:
After Swapping : 5*0=0
First Number : 6 5*1=5
Second Number : 5
5 * 2 = 10 You look older than 25
5 * 3 = 15
.... 12. Write a C# program to that takes a number as input and
display it four times in a row (separated by blank spaces), and
5 * 10 = 50 then four times in the next row, with no separation. You
should do it two times: Use Console. Write and then use {0}.
9. Write a C# Sharp program that takes four numbers as input Test Data:
to calculate and print the average. Enter a digit: 25
Test Data: Expected Output:
Enter the First number: 10 25 25 25 25
Enter the Second number: 15 25252525
Enter the third number: 20 25 25 25 25
Enter the four number: 30 25252525
Expected Output:
The average of 10 , 15 , 20 , 30 is: 18 13. Write a C# program that takes a number as input and then
displays a rectangle of 3 columns wide and 5 rows tall using
that digit.
10. Write a C# Sharp program to that takes three
numbers(x,y,z) as input and print the output of (x+y).z and x.y Test Data:
+ y.z.
Enter a number: 5
Test Data:
Expected Output:
Enter first number - 5 555
Enter second number - 6 55
Enter third number - 7 55
Expected Output: 55
Result of specified numbers 5, 6 and 7, (x+y).z is 77 and x.y +
555
y.z is 72
14. Write a C# program to convert from celsius degrees to
11. Write a C# Sharp program that takes an age (for example Kelvin and Fahrenheit.
20) as input and prints something as "You look older than 20".
Test Data:
Test Data:
Enter the amount of celsius: 30
Enter your age - 25
Expected Output:
Expected Output:
Kelvin = 303
Fahrenheit = 86 Input first integer:
-5
15. Write a C# program remove specified a character from a Input second integer:
non-empty string using index of a character.
25
Test Data:
Check if one is negative and one is positive:
w3resource
True
Sample Output:
wresource
19. Write a C# program to compute the sum of two given
w3resourc integers, if two values are equal then return the triple of their
sum.
3resource
Output:
Enter first num: 2
16. Write a C# program to create a new string from a given
string where the first and last characters will change their Enter second num: 4
positions.
Output is 6
Test Data:
w3resource
Enter first num: 4
Python
Enter second num: 4
Sample Output:
Output is 24
e3resourcw
nythoP
x
20. Write a C# program to get the absolute value of the
difference between two given numbers. Return double the
absolute value of the difference if the first number is greater
17. Write a C# program to create a new string from a given
than second number.
string (length 1 or more ) with the first character added at the
front and back.
Sample Output: 21. Write a C# program to check the sum of the two given
integers and return true if one of the integer is 20 or if their
Input a string : The quick brown fox jumps over the lazy dog. sum is 20.
TThe quick brown fox jumps over the lazy dog.T
22. Write a C# program to check if an given integer is within
18. Write a C# program to check two given integers and return 20 of 100 or 200.
true if one is negative and one is positive. Sample Output:
Sample Output: Input an integer:
25 Sample Output:
False Sum of the first 500 prime numbers:
3682913
23. Write a C# program to convert a given string into
lowercase.
27. Write a C# program and compute the sum of the digits of
Sample Output: an integer.
write a c# sharp program to display the following pattern Sample Output:
using the alphabet.
Input a number(integer): 12
Sum of the digits of the said integer: 3
24. Write a C# program to find the longest word in a string.
Test Data: Write a C# Sharp Program to display the following
pattern using the alphabet. 28. Write a C# program to reverse the words of a sentence.
Sample Output: Sample Output:
Original String: Display the pattern like pyramid using the
following
alphabet.
Reverse String: alphabet. the using pyramid like pattern the
25. Write a C# program to print the odd numbers from 1 to Display
99. Prints one number per line.
Sample Output:
29. Write a C# program to find the size of a specified file in
Odd numbers from 1 to 99. Prints one number per line. bytes.
1 Sample Output:
3 Size of a file: 31
7 30. Write a C# program to convert a hexadecimal number to
decimal number.
9
Sample Output:
...
Hexadecimal number: 4B0
95
Convert to-
97
Decimal number: 1200
99
31. Write a C# program to multiply corresponding elements of
26. Write a C# program to compute the sum of the first 500 two arrays of integers.
prime numbers.
Sample Output:
Array1: [1, 3, -5, 4] Input a first number(<100): 75
Array2: [1, 4, -5, -2] Input a second number(>100): 250
Multiply corresponding elements of two arrays: True
1 12 25 -8
36. Write a C# program to check if an integer (from the two
given integers) is in the range -10 to 10.
32. Write a C# program to create a new string of four copies,
taking last four characters from a given string. If the length of Sample Output:
the given string is less than 4 return the original one.
Input a first number: -5
Sample Output:
Input a second number: 8
Input a string : The quick brown fox jumps over the lazy dog.
True
dog.dog.dog.dog.
37. Write a C# program to check if "HP" appears at second
33. Write a C# program to check if a given positive number is a position in a string and returns the string without "HP".
multiple of 3 or a multiple of 7.
Test Data: PHP Tutorial
Sample Output:
Sample Output:
Input first integer:
P Tutorial
15
True
38. Write a C# program to get a new string of two characters
from a given string. The first and second character of the given
string must be "P" and "H", so PHP will be "PH".
34. Write a C# program to check if a string starts with a
specified word. Test Data: PHP
Note: Suppose the sentence starts with "Hello" Sample Output:
Sample Data: string1 = "Hello how are you?" PH
Result: Hello.
Sample Output: 39. Write a C# program to find the largest and lowest values
from three integer values.
Input a string : Hello how are you?
Test Data:
True
Input first integer:
15
35. Write a C# program to check two given numbers where
one is less than 100 and other is greater than 200. Input second integer:
Sample Output: 25
Input third integer:
30 43. Write a C# program to check if a given string starts with
"w" and immediately followed by two "ww".
Sample Output
Test Data:
Largest of three: 30
Input a string : www
Lowest of three: 15
Sample Output
False
40. Write a C# program to check the nearest value of 20 of
two given integers and return 0 if two numbers are same.
Test Data: 44. Write a C# program to create a new string of every other
character (odd position) from the first position of a given
Input first integer: string.
15 Test Data:
Input second integer: Input a string : w3resource
12 Sample Output
Sample Output wrsuc
15
45. Write a C# program to count a specified number in a given
41. Write a C# program to check if a given string contains ‘w’ array of integers.
character between 1 and 3 times. Test Data:
Test Data: Input an integer: 5
Input a string (conatins at least one 'w' char) : w3resource Sample Output
Test the string contains 'w' character between 1 and 3 times: Number of 5 present in the said array: 2
Sample Output
True 46. Write a C# program to check if a number appears as either
the first or last element of an array of integers and the length
is 1 or more.
42. Write a C# program to create a new string where the first 4
characters will be in lower case. If the string is less than 4 Test Data:
characters then make the whole string in upper case. Input an integer: 25
Test Data: Sample Output
Input a string: w3r False
Sample Output
W3R 47. Write a C# program to compute the sum of all the
elements of an array of integers. Test Data:
Test Data: Array1: [1, 2, 5, 7, 8]
Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] Highest value between first and last values of the said array: 8
Sample Output
Sum: 69 52. Write a C# program to create a new array of length
containing the middle elements of three arrays (each length 3)
of integers.
48. Write a C# program to check if the first element and the Test Data:
last element are equal of an array of integers and the length is
1 or more. Array1: [1, 2, 5]
Test Data: Array2: [0, 3, 8]
Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] Array3: [-1, 0, 2]
Sample Output New array: [2, 3, 0]
True
53. Write a C# program to check if an array contains an odd
number.
49. Write a C# program to check if the first element or the last
element of the two arrays ( length 1 or more) are equal. Test Data:
Test Data: Original array: [2, 4, 7, 8, 6]
Array1: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 1] Check if an array contains an odd number? True
Array2: [1, 2, 2, 3, 3, 4, 5, 6, 5, 7, 7, 7, 8, 8, 5]
Check if the first element or the last element of the two arrays
( leng th 1 or more) are equal.
Sample Output
True
50. Write a C# program to rotate an array (length 3) of
integers in left direction.
Test Data:
Array1: [1, 2, 8]
After rotating array becomes: [2, 8, 1]
51. Write a C# program to get the larger value between first
and last element of an array (length 3) of integers.