68 240
Assignments Done
99%
Successfully Done
In November 2018

Answer to Question #14368 in C++ for Marty

Question #14368
write a program that calculates the sum of n numbers
Expert's answer
#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 first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions