Skip to content

Instantly share code, notes, and snippets.

@MdKutubuddinSardar
Created August 19, 2018 06:21
Show Gist options
  • Save MdKutubuddinSardar/cf48ce79b72862b9af91ad5cc29d4d21 to your computer and use it in GitHub Desktop.
Save MdKutubuddinSardar/cf48ce79b72862b9af91ad5cc29d4d21 to your computer and use it in GitHub Desktop.
Add n numbers using array in C
/*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