CALCULATE THE SUM OF N NUMBERS


#include<stdio.h>
#include<conio.h>
void main()
{
        int sum, n, num;
printf("How many numbers");
scanf("%d",&n);
for(sum = 0; n > 0; n--)
{
printf("Enter a number: ");
scanf("%d",&num);
sum += num;
}


printf("Sum = %d",sum);
}

0 comments: (+add yours?)

Post a Comment