Last active
August 19, 2018 06:18
-
-
Save MdKutubuddinSardar/d3e734ba712a912aea25828b5577f7cc to your computer and use it in GitHub Desktop.
Add n numbers in C programming
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 program to add n numbers */ | |
/* Author : Md Kutubuddin Sardar/ | |
/*Date : 19.08.2018*/ | |
#include <stdio.h> | |
int main() | |
{ | |
int n, sum = 0, c, value; | |
printf("Enter the number of integers you want to add\n"); | |
scanf("%d", &n); | |
printf("Enter %d integers\n",n); | |
for (c = 1; c <= n; c++) | |
{ | |
scanf("%d", &value); | |
sum = sum + value; | |
} | |
printf("Sum of entered integers = %d\n",sum); | |
return 0; | |
} | |
/* OUTPUT : | |
Enter the number of integers you want to add | |
5 | |
Enter 5 integers | |
2 | |
3 | |
4 | |
5 | |
6 | |
Sum of entered integers = 20 | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment