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"); }
Comments
Leave a comment