//what is the error in this program??
#include <iostream>
#define size 5
using namespace std;
int main () {
int numbers=(5,10,15,20,25,30,35,40}; double total, average;
for (int i;i <size;i++)
total+= numbers;
average = total/size;
cout << "Average" << average << endl;
return 0;
}
The counter variable i was not initialized.
Comments
Leave a comment