I wrote out a program that asks the user to input the length they would like the array to be and to input integers in the array, then it out puts each number at each index. What can i do to get the program to output the sum of the array and the mean of the array??
#include<iostream.h>
void main()
{
int x[100];
int i, count, y, sum = 0;
cout<<"Enter how long? ";
cin>>count;
for(i = 0; i < count; i
{
cout<<"Enter value? ";
cin>>y;
x= y;
}
for(i = 0; i < count; i++)
{
cout<<" Array X at index "<<i<<"= "<<x<<endl ;
}
}
#include<iostream.h>
void main()
{
int x[100];
int i, count, y, sum = 0;
cout<<"Enter how long? ";
cin>>count;
for(i = 0; i < count; i
{
cout<<"Enter value? ";
cin>>y;
x= y;
}
for(i = 0; i < count; i++)
{
cout<<" Array X at index "<<i<<"= "<<x<<endl ;
}
}