Professional Documents
Culture Documents
LO3 LO5 ProgramQuiz MoodleUpload
LO3 LO5 ProgramQuiz MoodleUpload
Expected Output :
Today: Monday
_____________________________________________________________________________________
2. Write a program in C# to create a function for the sum of two numbers and reuse by calling it from
main method.
Expected Output :
--------------------------------------------------
_____________________________________________________________________________________
3. Write a program in C# to create a function to input a string and count the number of spaces within the
string.
Expected Output :
----------------------------------------------------
Expected Output:
---------------------------------------------------------------------------
element - 0 : 1
element - 1 : 2
element - 2 : 3
element - 3 : 4
element - 4 : 5
Expected Output:
----------------------------------------------------------
After swapping,
_____________________________________________________________________________________
6. Write a C# program to create a function to display the n number Fibonacci sequence.
Expected Output:
------------------------------------------------------------
0 1 1 2 3 5 8 13 21 34
_____________________________________________________________________________________
If two values are the same, return the triple of their sum. Otherwise, return their differences value.
Expected Output:
Output: (2+2)*3 = 12
(or)
Output: (3-2) = 1
_____________________________________________________________________________________
8. Write a C# program to check whether the given integer must be between 20 and 100.
Expected Output:
Input an integer: 15
False
Input an integer: 80
True
_____________________________________________________________________________________
9. Write a C# program to print odd numbers from 1 to 99 as console output. Prints one number per line.
The sample output as follows:
Expected Output:
...
95
97
99
_____________________________________________________________________________________
10. Write a C# program to compute the total sum of each integer's digit value.
Expected Output:
_____________________________________________________________________________________
11. Write a C# program to reverse the words of a sentence without using Reverse () Method.
Expected Output:
_____________________________________________________________________________________
12. Write a C# program to find the largest and lowest values from three integer values.
Expected Output:
Largest of three: 3
Lowest of three : 1
_____________________________________________________________________________________
13. Write a C# program to create a string where the first 4 characters are in lower case.
If the string is less than 4 characters, make the whole string in upper case.
Expected Output:
_____________________________________________________________________________________
14. Write a C# Sharp program to read 10 numbers and find their average and sum.
Expected Output:
-----------------------------------------------------------------
Number-1 :2
Number-2 :4
Number-3 :6
Number-4 :8
Number-5 :10
Number-6 :12
Number-7 :14
Number-8 :16
Number-9 :18
Number-10 :20
_____________________________________________________________________________________
**
***
****
Expected Output:
-----------------------------------------------------------------
**
***
****
*****
******
*******
********
*********
**********
_____________________________________________________________________________________
17. Write a program in C# Sharp to display a pattern like a right-angle triangle with a number.
12
123
1234
Expected Output:
--------------------------------------------------------------------------
12
123
1234
12345
_____________________________________________________________________________________
18. Write a C# Sharp program to display an alphabet pattern like P with an asterisk.
Expected Output:
---------------------------------------------------------
****
* *
* *
****
_____________________________________________________________________________________
19. Write a C Sharp program to display an alphabet pattern like ‘Z’ with an asterisk.
Expected Output:
--------------------------------------------------------
*******
*******
_____________________________________________________________________________________
20. Write a C# program to output the name and age attributes of the Student class with data hiding
(encapsulation) feature and the sample output in console as follows:
Expected Output:
Sample Output:
Name: James
Age: 21
_____________________________________________________________________________________