Answer to Question #16096 in C++ for Chinny

Question #16096
Write a C++ program that asks the user for 10 integers and prints their SUM and their Average.
1
Expert's answer
2012-10-10T11:23:53-0400
#include<iostream>
using namespace std;

int a[10], sum=0;

void main(){
cout<<"enter 10 integers:\n";
for (int i=0; i<10; i++) cin>>a[i];
for (i=0; i<10; i++) sum += a[i];
cout<<"The sum is "<<sum<<"\nThe average is "<<sum/10.0<<"\n";
system("pause");
}




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS