0% found this document useful (0 votes)
10 views1 page

Assignment No.12 While Loop

The document outlines a series of programming tasks that involve using while loops to perform various operations, including printing prime numbers, calculating sums, generating sequences, and creating patterns. Each task is designed to enhance programming skills through practical applications of loops and algorithms. The tasks range from simple calculations to more complex implementations like the Sieve of Eratosthenes and number guessing games.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views1 page

Assignment No.12 While Loop

The document outlines a series of programming tasks that involve using while loops to perform various operations, including printing prime numbers, calculating sums, generating sequences, and creating patterns. Each task is designed to enhance programming skills through practical applications of loops and algorithms. The tasks range from simple calculations to more complex implementations like the Sieve of Eratosthenes and number guessing games.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

1.

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).

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy