In: Computer Science
ScreenShot:-
Code:-
#include <iostream>
using namespace std;
int main()
{
int n[10]; // declaring array of size 10 to store 10 values.
int sum=0,avg, max,min;
int i;
for(i=0;i<10;i++)
{
cout << "Enter the "<<i + 1<<" number : "<<
endl;
cin>>n[i];
}
//finding sum of all elements
for(i=0;i<10;i++){
sum=sum+n[i];
}
cout<<"The sum of all elements is :
"<<sum<<endl;
//finding the average of all elements
avg=sum/10;
cout<<"The average of elements is :
"<<avg<<endl;
//finding minimum and maximum element
// Assuming the first element is maximum and minimum
max=n[0];
min=n[0];
for(i=1;i<10;i++)
{
if(max<n[i])
max=n[i];
if(min>n[i])
max=n[i];
}
cout<<"The maximum number is :
"<<max<<endl;
cout<<"The minimum number is :
"<<min<<endl;
return 0;
}