The document contains a list of programming tasks in C# that include displaying natural numbers, calculating sums and averages, printing patterns, and determining properties of numbers such as prime status and factorial. Each task is clearly defined with specific requirements and expected outputs. The tasks range from basic number manipulation to pattern generation and mathematical calculations.
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
0 views
Lab 5
The document contains a list of programming tasks in C# that include displaying natural numbers, calculating sums and averages, printing patterns, and determining properties of numbers such as prime status and factorial. Each task is clearly defined with specific requirements and expected outputs. The tasks range from basic number manipulation to pattern generation and mathematical calculations.
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
1.Write a program in C# to display the first 10 natural numbers.
2. Write a C# program to find the sum of the first 10 natural
numbers. 3. Write a program in C# to read 10 numbers from the keyboard and find their sum and average. 4. Write a program using a for loop that prints all the numbers from 10 to 150 that are divisible by both 5 and 7. 5. Write a program in C# to display the cube of the number upto given an integer. input: 4 output: 1 8 27 64
6. Write a program in C# to display the pattern like a right angle
triangle using an asterisk. Sample input: 4 Sample output: * ** *** ****
7. Write a program in C# to display the pattern like a right angle
triangle with a number. 1 12 123 1234
8. Write a C# program to calculate the factorial of a given
number.
9. Write a C# program to determine whether a given number is
prime or not.
10. Write a C# program to check whether a given number is an