Tuesday, August 2, 2022

program to find the sum of n input numbers

/* program to find the sum of n input numbers*/

#include<stdio.h>

#include<conio.h>

main()

{

int i,n,number[100],temp=0;

printf ("Enter the number of element:");

scanf("%d",&n);

printf("\n Enter the number");

for(i=0;i<n;i++)

{

scanf("%d",&number[i]);

}

for(i=0;i<n;i++)

{

temp=temp+number[i];

}

//printing the sum of the number

printf("\n The sum of the whole number is: %d",temp);

getch();

}




No comments:

Post a Comment