Write a program that asks the user for a positive nonzero integer value

Write a program that asks the user for a positive nonzero integer value

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 heshe 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 heshe 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 =  95 * 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

Correct!

5 * 12 = 60

Correct!

8 * 3 = 24

19 * 14 = 256

Incorrect; the answer was 266

You solved 2 correctly

"96% of our customers have reported a 90% and above score. You might want to place an order with us."

Essay Writing Service
Affordable prices

You might be focused on looking for a cheap essay writing service instead of searching for the perfect combination of quality and affordable rates. You need to be aware that a cheap essay does not mean a good essay, as qualified authors estimate their knowledge realistically. At the same time, it is all about balance. We are proud to offer rates among the best on the market and believe every student must have access to effective writing assistance for a cost that he or she finds affordable.

Caring support 24/7

If you need a cheap paper writing service, note that we combine affordable rates with excellent customer support. Our experienced support managers professionally resolve issues that might appear during your collaboration with our service. Apply to them with questions about orders, rates, payments, and more. Contact our managers via our website or email.

Non-plagiarized papers

“Please, write my paper, making it 100% unique.” We understand how vital it is for students to be sure their paper is original and written from scratch. To us, the reputation of a reliable service that offers non-plagiarized texts is vital. We stop collaborating with authors who get caught in plagiarism to avoid confusion. Besides, our customers’ satisfaction rate says it all.

© 2022 Homeworkcrew.com provides writing and research services for limited use only. All the materials from our website should be used with proper references and in accordance with Terms & Conditions.

Scroll to Top