Next: The for statement
Up: The do-while statement
Previous: Review Questions
do-while
statement rather
than a while
statement.
do-while
statement rather
than a while
statement.
A set of examination marks expressed as percentages are to be processed by computer. Data entry is terminated by entering a negative percentage value. As each examination mark is entered it should be validated as being either a valid percentage or as being a negative number. The program should ask for the data entry to be repeated until a valid value is entered. The program should then output the number of percentage marks entered, the average mark and how many marks were above 40The program should implement the loop by using a
do-while
loop.