Add n Numbers

Add N Numbers in C Programming

#include

int main()
{
int n, sum = 0, c, value;

printf(“Enter the number of integers you want to add\n”);
scanf(“%d”, &n);

printf(“Enter %d integers\n”,n);

for (c = 1; c <= n; c++)
{
scanf(“%d”, &value);
sum = sum + value;
}

printf(“Sum of entered integers = %d\n”,sum);

return 0;
}

Comments

comments

Leave a Reply

Your email address will not be published. Required fields are marked *