C program to add N numbers.

#include<stdio.h>
#include<conio.h>
void main()
{
 clrscr();
 int i, n, sum=0, num;
 printf("How many elements?");
 scanf("%d",&n);
 printf("Enter %d number :",n);
 for(i=0;i<n;i++)
 {
  scanf("%d",&num);
  sum=sum+num;
 }
 printf("Sum of all the %d number is %d",n,sum);
 getch();
}
C program to add N numbers. C program to add N numbers. Reviewed by on December 22, 2019 Rating: 5

No comments:

Powered by Blogger.