0% found this document useful (0 votes)
2 views

02 Assignment

This document outlines a C# programming course with a focus on loops. It includes a series of programming exercises that require the use of while and for loops to perform various tasks, such as printing numbers, calculating sums, and generating factorials. The deadline for the course is set for March 22, 2025.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

02 Assignment

This document outlines a C# programming course with a focus on loops. It includes a series of programming exercises that require the use of while and for loops to perform various tasks, such as printing numbers, calculating sums, and generating factorials. The deadline for the course is set for March 22, 2025.
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 2

1

Introduction to C# Programming

Course Name Programming Language 2


Course No Programming Language
Lab No 4,5
Chapter C#
Deadline 22/03/2025
03 Loop
1. Write a program that prints numbers from 1 to 100 using a while loop.
2. Write a program that calculates the sum of even numbers from 1 to 100
using a while (and do while) loop.
3. Write a program that takes a number as input and keeps asking the user
to enter another number until the user enters a zero. Then, print the
average of all the numbers entered(and do while).
4. Write a program that takes a positive integer as input and calculates its
factorial using a while (and do while) loop.
5. Write a program that prints numbers from 1 to 10 using a for loop .
6. Write a program that calculates the sum of squares of numbers from 1
to 10 using a for loop (and do while).
7. Write a program that takes a starting number and an ending number as
input and prints the even numbers between them using a for loop.
8. Write a program that calculates the factorial of a given number using a
for loop (and do while).
9. Write a program that generates a table of squares and cubes of numbers
from 1 to 10 using a for loop.
10. Write a program that prints the reverse order of numbers from 10 to 1
using a for loop.

βelal A. Hamed C# Programming Languages


2
Introduction to C# Programming

11. Write a program that calculates the sum of prime numbers from 1 to
100 using a for loop.

βelal A. Hamed C# Programming Languages

You might also like