C Program to Add n numbers

#include <stdio.h>
#include <conio.h>

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;
        /*adding each no in sum*/
    }

    printf("Sum of entered integers = %d\n",sum);
    getch();

    return 0;
}

Output
-----------


Comments

Popular posts from this blog

Introduction to C++ Programming Language

The Assembly Process Of 8086 Microprocessor-Two Pass Assembling Steps

Installing 8086 Assembler on a Computer