Created
August 19, 2018 06:21
-
-
Save MdKutubuddinSardar/cf48ce79b72862b9af91ad5cc29d4d21 to your computer and use it in GitHub Desktop.
Add n numbers using array in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*C programming code using array*/ | |
/* Author : Md Kutubuddin Sardar*/ | |
/*Date : 19.08.2018*/ | |
#include <stdio.h> | |
int main() | |
{ | |
int n, sum = 0, c, array[100]; | |
printf("Enter the number of integers you want to add : "); | |
scanf("%d", &n); | |
for (c = 0; c < n; c++) | |
{ | |
scanf("%d", &array[c]); | |
sum = sum + array[c]; | |
} | |
printf("Sum = %d\n",sum); | |
return 0; | |
} | |
/* OUTPUT : | |
Enter the number of integers you want to add | |
5 | |
Enter 5 integers | |
4 | |
67 | |
8 | |
9 | |
7 | |
Sum of entered integers = 95 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment