Couples of days I am trying to do this exercises.
Design and write a program to read int values from the keyboard until a value of -999 is entered.The program should calculate the average (as a double) of all the numbers except the terminating value (the -999 terminating value is know as a sentinel). You will need both a loop and an if/else structure, and variables to store the number of values entered and a running total of the summated input values. Notes this does not utilise an array.
Aucun commentaire:
Enregistrer un commentaire