find sum and avg of number using array in c+= for loop
#include <iostream>
using namespace std;
main ()
{
int n[10],sum,avg;
for(int i=0;i<10;i++)
{
cout<<"enter the number"<<i+1<<" = ";
cin>>n[i];
}
for (int i=0;i<10;i++)
{
sum+=n[i];
avg=sum/5;
}
cout<<"sum of the number is = "<<sum<<endl;
cout<<"avg of the number is = "<<avg;
}
0 on: "find sum and avg of number using array in c+= for loop"