Categories

Average of numbers inputted

#include
#include

int Average(int i)
{
static int sum = 0, count = 0;
sum = sum + i;
count++;
return sum / count;
}

int main()
{

int num;
do{

cout<<"Enter numbers ( -1 to quit )"< cin>>num;
/*if number is not -1 print the average*/
if(num != -1)
cout<<"The average is "<

}while(num>-1);
return 0;
}

No related posts.

Related posts brought to you by Yet Another Related Posts Plugin.

You must be logged in to post a comment.