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

Loops C

The document lists 10 examples each of for, do-while, and while loops in programming. The for loop examples include printing numbers in sequences, finding sums, and multiplication tables. The do-while examples focus on reading input until a condition is met and performing calculations. The while loop examples are nearly identical to the for loop ones.

Uploaded by

Temp Use
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views

Loops C

The document lists 10 examples each of for, do-while, and while loops in programming. The for loop examples include printing numbers in sequences, finding sums, and multiplication tables. The do-while examples focus on reading input until a condition is met and performing calculations. The while loop examples are nearly identical to the for loop ones.

Uploaded by

Temp Use
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

For loop:-

1. program to print all natural numbers from 1 to n


2. program to print natural numbers in reverse from n to 1
3. program to print alphabets from a to z
4. program to print all even numbers from 1 to 50
5. program to print all odd numbers from 1 to 50
6. program to find sum of natural numbers from 1 to n
7. program to find sum of odd numbers from 1 to n
8. program to print multiplication table of a given number
Input
Input num: 5
Output
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
9. program to find first and last digit of any number
10. program to check whether a number is palindrome or not

do while loop:-
1. program to count number of digits in an integer
2. WAP to read numbers while numbers entered is not equals
to zero. And find sum of all numbers entered.
3. WAP to read numbers while numbers entered is not equals
to zero. And find sum of all Even numbers entered.
4. WAP to read number while number entered is not equals to
zero. And find sum of all even number and odd number
entered.
5. WAP to read number while number entered is not equals to
zero. And count all negative number entered.
6. WAP to read number while number entered is not equals to
zero. And count all negative number as well as positive number
entered entered .
7. WAP to print table of three using do while loop
3 6 9 12 15 18 21 24 27 30
8. Program to calculate the Simple interest.
SI = (Principal * Rate * Time) / 100
While loop:-
1. program to print all natural numbers from 1 to n
2. program to print natural numbers in reverse from n to 1
3. program to print alphabets from a to z
4. program to print all even numbers from 1 to 50
5. program to print all odd numbers from 1 to 50
6. program to find sum of natural numbers from 1 to n
7. program to find sum of odd numbers from 1 to n
8. program to print multiplication table of a given number
Input
Input num: 5
Output
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50
9. program to find first and last digit of any number
10. program to check whether a number is palindrome or not

You might also like