Q:

C PROGRAM TO FIND SUM OF N NUMBERS:

0

C PROGRAM TO FIND SUM OF N NUMBERS:

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include 
 
int main()
 
{
 
     int num, sum = 0, count, i;
 
     printf("Please enter how many numbers you want to add\n");
 
     scanf("%d", &num);
 
     printf("Please enter %d numbers one by one\n",num);
 
 
 
     for (count = 1; count <= num; count++)
 
     {
 
         scanf("%d",&i);
 
         sum = sum + i;
 
     }
 
     printf("Sum of entered numbers = %d\n",sum);
 
     return 0;
 
}

Output:

3

Please enter 3 numbers one by one

40

20

10

 

Sum of entered numbers = 70

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now