C program to print the sum of all numbers in a given array
codeaft.c
#include<stdio.h>intmain(){intsum=0;intarr[5]={100,15,8,45,93};for(inti=0;i<5;i++){sum=sum+arr[i];}printf("The addition of a given array is %d ",sum);return0;}
Output
codeaft@codeaft:~$ gcc codeaft.c codeaft@codeaft:~$ ./a.out
The addition of a given array is 261
codeaft@codeaft:~$
Dear User, Thank you for visitng Codeaft. If you are interested in technical articles, latest technologies, and our journey further, please follow us on LinkedIn.