#### C-programming - Addition of n numbers, C program for adding n numbers

#### Addition of n numbers

This c program add n numbers which will be entered by the user.#include<stdio.h> #include<conio.h> main() { int n, sum = 0, a, var; printf("Enter the number of integers for addition\n"); scanf("%d",&n); printf("Enter %d numbers\n",n); for ( a = 1 ; a <= n ; a++ ) { scanf("%d",&var); sum = sum + var; } printf("Sum of entered numbers is %d\n",sum); getch(); return 0; }

Here initially the number of integers indicating how many numbers to be added is entered. Then the numbers are entered individually using a for loop.Then the total summed value is printed.

output

Enter the number of integers for addition 3 Enter 3 numbers 1 2 3 Sum of entered numbers is 6

The topic on C-programming - Addition of n numbers is posted by - Shree

Hope you have enjoyed, C-programming - Addition of n numbersThanks for your time