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

  • Want to organize your cloud files? Sign up for a free webinar to see how Dokkio (a new product from PBworks) can help you find, organize, and collaborate on your Drive, Gmail, Dropbox, and Slack files: Weds, May 27 at 2PM Eastern / 11AM Pacific
View
 

AverageRainfall

Page history last edited by PBworks 12 years, 3 months 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.