Answer to Question #202729 in C for sai

Question #202729

Write a program using a 1D array to evaluate the following expressions:

Total = ∑ (Xi)^2

where summation is from i=1 to 10.


1
Expert's answer
2021-06-04T06:05:30-0400
#include <math.h>
#include <stdio.h>
int main(){
int s=0;int num[11];

num[1]=12;
num[2]=15;
num[3]=17;
num[4]=19;
num[5]=34;
num[6]=40;
num[7]=35;
num[8]=34;
num[9]=24;
num[10]=26;


for(int i=1;i<=10;++i){
s=s+pow(num[i],2);
printf("%d\n",s);
}
return 0;


}

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