This c program to add n numbers which will be entered by the user. If the user enter the 0 then automatically exit the addition of a numbers, And display the sum of numbers, And also display the numbers of added numbers to count. In our C program to add numbers we are not using an array, if you wish you can use an array.
C programming code
#include<stdio.h>
#include<conio.h>
void main()
{
int n, sum = 0, c=0;
clrscr();
printf("\n Enter the number of integers you want to add & 0 to Exit -> ");
do
{
scanf("%d",&n);
sum = sum + n;
c=c+1;
}while(n!=0);
printf("\nSum of entered numbers = %d ,And Total numbers=%d",sum,c);
getch();
}
Output:-

C programming code
#include<stdio.h>
#include<conio.h>
void main()
{
int n, sum = 0, c=0;
clrscr();
printf("\n Enter the number of integers you want to add & 0 to Exit -> ");
do
{
scanf("%d",&n);
sum = sum + n;
c=c+1;
}while(n!=0);
printf("\nSum of entered numbers = %d ,And Total numbers=%d",sum,c);
getch();
}
Output:-
