How to do SUM OF SQUARES of elements in an array using 'C'(for inputing values)😅 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

How to do SUM OF SQUARES of elements in an array using 'C'(for inputing values)😅

25th Jul 2022, 12:10 PM
Muhammed Rishad. K
Muhammed Rishad. K - avatar
1 Answer
+ 4
#include <stdio.h> #include<math.h> int main() { int arr[10]={1,2,3,4,5,6,7,8,9,10}; int sum=0; for(int index=0;index<10;index++) { sum=sum+pow(arr[index],2); } printf("Sum-> %d",sum); return 0; }
25th Jul 2022, 12:39 PM
Mihir Lalwani
Mihir Lalwani - avatar