Write a program to find sum of N numbers in C Language - Program to find sum of N numbers in C - Sum of N numbers in C

 Program to find the sum of N numbers in C

#include<stdio.h>

int main()

{

    int n,sum=0,c,value;

    printf("Enter the number you want to add = ");

    scanf("%d", &n);

    printf("Enter %d integers\n",n);

    for(c = 1; c <= n; c++)

        {

            scanf("%d", &value);

            sum += value;

        }

   printf("\nSum of the given numbers is = %d\n", sum);

    return 0;

}

इस कोड को हमने CODEBLOCK पर बना कर run किया है

OUTPUT

Comments