C Program To Calculate The Of N Numbers Using Array


♣ Try it Out ::
#include<stdio.h>
#include<conio.h>

main()
{
    int Num[101], Sum = 0, TotalNum, i;

    printf("How many numbers you wish to add: ");
    scanf("%d", &TotalNum);

    printf("Enter %d Integers: ", TotalNum);
    for(i=0; i<TotalNum; i++)
        scanf("%d", &Num[i]);

    for(i=0; i<TotalNum; i++)
        Sum = Sum + Num[i];

    printf("\nSum of entered numbers is = %d\n", Sum);

    getch();
    return(0);
}

♣ Output ::
How many numbers you wish to add: 5
Enter 5 Integers: 125 10 25 30 450

Sum of entered numbers is = 640

♣ Downloads ::

Comments

Popular posts from this blog

C++ :: Topological Sort Algorithm (using DFS)

How to Hack Facebook Account

C++ :: Strongly Connected Components Algorithm (SCC)