C Program to Calculate Sum of Array Elements(Integer)
In this program we will take an array of integer element as an input from user and calculate the sum of elements.
- //C program to find sum of array elements
-
- #include<stdio.h>
- #include <conio.h>
-
- int main()
- {
- int c[100],i,n,sum=0;
-
- printf("Enter size of the array : ");
- scanf("%d",&n);
-
- printf("Enter elements in array : ");
- for(i=0; i<n; i++)
- {
- scanf("%d",&c[i]);
- }
-
-
- for(i=0; i<n; i++)
- {
-
- sum+=c[i];
- }
- printf("sum of array is : %d",sum);
-
- return 0;
- }
Output

Solution not working or have any suggestions? Please send an email to [email protected]
Download Android App