While Loop Questions


1. Write a program that will let you enter a number and will then print out the multiples for that number under 1000.

2. Write a program that will let you enter numbers until you enter a -1 and will then print out the sum and the average of the numbers that you entered.

3. A cell doubles every hour. If you start with 1 cell how many hours until you have 5000000 cells. Write a program that will tell you the answer.

4. Find LCM for 2 numbers entered.

5. Find GCF for 2 numbers entered.

6. Print out first 5 factors of a number that is entered.

7. Print out 5 biggest factors of a number that is entered.

8. 1/2 + 1/3 + 1/4 .... What denominator makes sum go over 4? Write a program to tell you the answer.

9. 1 + 4 + 7 + 10 ... What is last number that makes sum go over 1 million.

10. 2000 in bank. 5% interest a year. You withdraw 50 a year. How many years until you have at least 5000.

11. You sell house for 200000. You get 4% interest a year. You spend 14000 a year. How many years until you run out of money.

12. You start with 2 rabbits. They double every 14 days. How many days until you have 5000 rabbits.

13. Write a program that will let you enter a number and will then tell you whether the number is prime or not.

14. Enter an amount of money. How many years until it doubles at 4% compounding interest?

15. Write a program that will let you enter numbers until you enter a -1. It will then print out the biggest and the smallest numbers that were entered.

16. There are 3,143,142 people in Connecticut but the population is decreasing by 2% a year. There are 1,704,136 people in Montana but their population is increasing by 12% a year. If the rates remain the same, how many years will it be before Montana has more people than Connecticut?

17. Write a program that will ask you to enter an amount of money. It will then ask you to enter an interest rate (as a decimal). It will then ask you to enter a target amount of money. The money will be compounded yearly. Write a program that will tell you how many years it will take to reach your target.

18. The wolf population in Alaska is 4,445,445,489. It is losing 3% of its population a year. At this rate how many years until there are less than 1 million.

19. The world population is 6,602,224,175. It is increasing at a rate of 1.1% a year. At this rate how many years until the population reachers 8 billion.

20. Write a program that will add 5 + 7 + 10 + 14 + 19 + 25 ... until the sum gets over 10000, What number made it go over.

21. 1/3 + 2/5 + 3/7 + 4/9 + 5/11 ...
What fraction gets sum to go over 1000

22. You have $5000 in the bank, Every year you take out 7% of what is left. How many years until you have under $100?