hi
Using while, write a program that keeps reading integers from user until he enters -1 then prints
the average of all entered numbers (-1 should be ignored).
this is my solution, but i dont know why he gives me wrong average?
#include<iostream>
using namespace std;
void main()
{
double Number=0,average,sum=1,count;
while(Number!=-1)
{
cout << "Enter a Number\n";
cin >> Number;
sum+=Number;
count++;
average=sum/count;
}
cout << "average= " << average<< endl;
}