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
Post a Comment