Write A Program That Ask For User Input From 5 To 9 Then Calculate The Average

Write A Program That Ask For User Input From 5 To 9 Then Calculate The Average


  • 13 Dec, 2011

    #include "iostream.h"int main() {int MAX = 4;int total = 0;int average;int numb;for (int i=0; i<MAX; i++) {cout << "Please enter your input between 5 and 9: ";cin >> numb;while ( numb<5 || numb>9) {cout << "Invalid input, please re-enter: ";cin >> numb;}total = total + numb;}average = total/MAX;cout << "The average number is: " << average << "n";return 0;}

    Comments Received:
    Please give your suggestions and feedback:

2009-2016 downloadmela.com. All rights reserved.