| 
  • If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

AverageRainfall

Page history last edited by PBworks 16 years, 1 month ago

Write a program that asks the user for the rain fall for three months, April, May, and June and then prints out the results in a table as shown below. Declare and initialize a variable to the rain fall for each month. Compute the average, and write out the results, something like:

 

Rainfall for April: 12

Rainfall for May : 14

Rainfall for June: 8

Average rainfall: 11.333333

 

To get the numerical values to line up use the tabulation character '\t' as part of the character string in the output statements. Check that your program prints the correct results.

 

 

Have the user enter the data for each month. Use rainfall statistics from Weather.com or another weather related site. Use a while loop to allow the user to continue or stop.

 

Look at EscapeSequences for help on the \t

Comments (0)

You don't have permission to comment on this page.