#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();
}
No comments: