Answer to Question #202721 in C for sai

Question #202721

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:03:37-0400
#include <stdio.h>
int main(void){
	int arr [10] = {5,6,78,8,4,3,2,45,89,98};
	//The expression is Total = summation(Xi) 2 
	int sum = 0.0;
	for(int i =0; i<10; i++ ){
		sum += arr[i];
	}
	int total = 2 * sum;
	printf("The summation of elements in the array is:  %d", total);
   
    
}

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