C Program to find sum of array elements


In this program, You will learn how to find sum of array elements in c.


for (i = 0; i < 10; i++) {

s = s + arr[i]; }


Example: How to find sum of array elements in c

Run it Now
#include<stdio.h>

int main() {

   int arr[10], i, s = 0;

   printf("Enter 10 Numbers :");
   for (i = 0; i < 10; i++) {
       scanf("%d", &arr[i]);
   }

   for (i = 0; i < 10; i++) {
       s = s + arr[i];
   }
   printf("\nThe Sum is :%d", s);

   return 0;
}

Output:

Enter 10 Numbers :10 20 30 40 50 60 70 80 90 100
The Sum is :550