Online course
Online course
1) Fill the code below so as to store values 1 4 9 16…100 in array x.
int x[11];
for(int i=..;i<=..;i++)
{
x[i]=…;
}
2) Write the necessary code so as the array x stores 100 values read from the standard input- keyboard and calculate the average of these values.
1) int x[11];
for(int i=1;i<=10;i++)
x[i]=i*i;
2) int x[100],sum=0;
for(int i=0;i<100;i++)
{
cin>>x[i];
sum+=x[i];
}
cout<<sum/100.0;