Sum of an array in C

Source code :

#include<stdio.h>

int main() {
    
   int i, sum=0;
 
   int a[10] = {10,9,8,7,6,5,4,3,2,1};
   
    for (i = 0; i < 10; i++){
        
      sum = sum + a[i];
      
    }
   
    printf("The Sum is : %d", sum);
    
    return 0;
 
}

Output :

The Sum is : 55

Output :


                

Comments :