Question 1: Write a program that asks the user for

Question 1:

Write a program that asks the user for a positive nonzero integer value. The program should use a loop (while loop) to get the sum of all the integers from 1 up to the number entered. For examples, if the user enters 50, the loop will find the sum of 1,2,3,4,….50.

Hint: You need two while loops here. One to make sure the user enters a positive number (keeps on asking the user for a number till he\she enters a positive nonzero number).  And two to find the sum.

Question 2:

The distance a vehicle travels can be calculated as follows:

                Distance = Speed * Time

For example, if a train travels 40 miles per hour for 3 hours, the distance traveled is 120 miles. Write a program that asks for the speed of a vehicle (in miles per hour) and the number of hours it has traveled. It should use a loop to display the distance a vehicle has traveled for each hour of a time period specified by the user. For example, if a vehicle is traveling at 40 mph for a 3 hour time period, it should display a report similar to the one that follows:

Hours                                    Distance

                1                                              40
                2                                              80
                3                                              120

Input validation: Do not accept a negative number for speed and do not accept any value less than 1 for time traveled (i.e. use a loop to keep on asking the user till he\she gives you an acceptable value for both).

Question 3:

Write a program that will predict the size of a population of organisms. The program should ask for the starting number of organisms, their average daily population increase (as a percentage), and the number of days they will multiply. For example, a population might begin with two organisms, have an average daily increase of 50 percent, and will be allowed to multiply for seven days. The program should use a loop to display the size of the population for each day. So for the previous example, the output should look like:

Day                        Organisms


1                              2.0

2                              3.0

3                              4.5

4                              6.75

5                              10.125

6                              15.1875

7                              22.78125

Input validation: Do not accept a number less than 2 for the staring size of the population. Do not accept a negative number for average percent daily population increase. Do not accept a number less than 1 for the number of days they will multiply.

Question 4:

Write a program with a loop that lets the user enter a series of integers. The user should enter -99 to signal the end of the series. After all the numbers have been entered, the program should display the largest and smallest numbers entered.

Question 5:

Write a program that displays a table of centigrade temperatures 0 through 20 and their Fahrenheit equivalents. The formula for converting a temperature from centigrade to Fahrenheit is:

                F =  9\5 * C + 32

Where F is the Fahrenheit temperature and C is the centigrade temperature. Your program must use a loop to display the table.

Question 6:

Write a multiplication tutor program. Ask user to solve problems with random numbers from 1-20. The program stops after an incorrect answer. The output should look like:

14 * 8 = 112


5 * 12 = 60


8 * 3 = 24

19 * 14 = 256

Incorrect; the answer was 266

You solved 2 correctly

Table of Contents

Calculate your order
Pages (275 words)
Standard price: $0.00

Latest Reviews

Impressed with the sample above? Wait there is more

Related Questions


 Coursework Task You will take on the role of an independent accident investigator for two cases one is a collision incident and the other a

New questions

Don't Let Questions or Concerns Hold You Back - Make a Free Inquiry Now!