Answer to Question #14368 in C++ for Marty

Question #14368
write a program that calculates the sum of n numbers
1
Expert's answer
2012-09-07T10:45:10-0400
#include<stdio.h>
#include<conio.h>
main()
{
int num,
n,sum=0,i=0;
printf("Enter the number of elements to be added:
");
scanf("%d",&n);
printf("Enter %d
numbers",n);
while(i<n)
{

scanf("%d",&num);
sum=sum+num;
i=i+1;
}
printf("The sum of
%d numbers is %d",n,sum);
getch();
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS