Assignment No.12 While Loop
Assignment No.12 While Loop
Write a program that uses a while loop to print all prime numbers between
1 and 20.
2. Create a program using a while loop to calculate and display the sum of
numbers from 1 to 50.
3. Write a program that uses a while loop to print the square of numbers from
1 to 15.
4. Implement a countdown timer using a while loop that starts from 10 and
counts down to 0.
5. Develop a program using a while loop to generate the Fibonacci sequence
up to the 10th term.
6. Create a program that takes a number as input and uses nested while loops
to print its multiplication table up to 10.
7. Write a program using a while loop to find the factorial of a given number.
8. Implement a program that uses a while loop to print a pattern of stars in
the shape of a right-angled triangle.
9. Develop a program using a while loop that checks whether a given number
is prime or not.
10. Create a program using a while loop to calculate and display the sum of
digits of a given number.
11. Write a program using a while loop to print the first n terms of the
geometric progression 2, 6, 18, 54, ...
12. Implement a program using nested while loops to generate a multiplication
table for numbers from start to end.
13. Create a program using nested while loops to print a pyramid pattern of
stars.
14. Develop a program using a while loop that simulates a basic dice roll,
displaying results for a specified number of rolls.
15. Write a program using nested while loops to find and display common
elements in two lists.
16. Implement a program using a while loop and the Sieve of Eratosthenes
algorithm to find all prime numbers in a given range.
17. Create a program using a while loop to generate the nth term of the
arithmetic progression 2, 5, 8, 11, ...
18. Write program using while loop to guess the number(number guessing
game).