C Program To Add n Numbers

0
774

C program to add n numbers

#include <stdio.h>
 
int main()
{
   int n, total = 0, i, value;
 
   printf("Enter the number of integers you want to add\n");
   scanf("%d", &n);
 
   printf("Enter %d integers\n",n);
 
   for (i = 1; i <= n; i++)
   {
      scanf("%d", &value);
      total = total + value;
   }
 
   printf("Total value of entered integers = %d\n", total);
 
   return 0;
}

Leave a Reply