lab10 - Maximum so far: 12 Enter a positive integer or -1...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
Lab 10: Finding a Maximum Last Modified 02/15/2009 Key Concepts: while loops, sentinel-controlled input Write a program that allows the user to enter any number of positive integers and determines the largest of them. The program must use a while loop and a sentinel value to stop the input. After each input has been read in, report the maximum so far. No error handling is required this time. Sample Interaction Enter a positive integer or -1 to quit: 12 Maximum so far: 12 Enter a positive integer or -1 to quit: 10
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Maximum so far: 12 Enter a positive integer or -1 to quit: 24 Maximum so far: 24 Enter a positive integer or -1 to quit: 20 Maximum so far: 24 Enter a positive integer or -1 to quit: 8 Maximum so far: 24 Enter a positive integer or -1 to quit: 31 Maximum so far: 31 Enter a positive integer or -1 to quit: 15 Maximum so far: 31 Enter a positive integer or -1 to quit: -1 Maximum so far: 31 Final maximum read: 31 Lab Report Code 3 sample runs...
View Full Document

Ask a homework question - tutors are online