0 votes
242 views
in Programming by (98.9k points)
edited
Write a c++ program to accept 10 integers in an array and find its sum and average?

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer
#include<iostream.h>
int main()
{
int arr[10];
int i,sum=0;
float avg;
cout<<"enter 10 number";
for(i=0;i<10;i++)
{
cin>>arr[i];
}
for(i=0;i<10;i++)
{
sum+=arr[i];
}
avg=sum/10;

cout<<"sum="<<sum<<endl;

cout<<"average="<<avg;

}

Related questions

0 votes
1 answer 425 views
0 votes
1 answer 439 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

563 users

...