Question

Please help with this C program?

i need some help with this one...

write a program that sums a sequence of integers. assume that the first integer read with scanf specifies the number of values remaining to be entered. your program should read only one value each time scanf is executed. a typical input sequence might be...

5 100 200 300 400 500

where 5 indicates that the subsequent five values are to be summed

Answers

Hi,

Here's your program.

#include<stdio.h>

#include<conio.h>

void main()

{

int n,sum=0,i,num;

printf("Enter the number of elements ");

scanf("%d",&n);

printf("\nEnter the numbers...");

for(i=0;i<n;i++)

{

scanf("%d",&num);

sum += num;

}

printf("\nSum=%d",sum);

getch();

clrscr();

}

#1

Show your code.

=

We will help you make it work right.

#2

How would the list of integers be entered into your program? You really need to give us code/more information for us to be able to help you.

#3

Copy URL: Please help with this C program? http://www.qfak.com/computers_internet/programming_design/?id=2508572