Code Box
------------------------------------------
/*program to sum list of numbers
*/
#include<stdio.h>
#include<conio.h>
void main()
{
int num[10];
int i,sum;
sum=0;
clrscr();
printf("\nEnter 10 number:");
for(i=0;i<10;i++)
{
scanf("%d",&num[i]);
}
printf("\nDone");
clrscr();
printf("\nYou entered:\n");
for(i=0;i<10;i++)
{
printf(" %d",num[i]);
}
printf("\n\nSum of the numbers are:\n");
for(i=0;i<10;i++)
{sum=sum+num[i];
}
printf("Sum :%d",sum);
getch();
}
No comments:
Post a Comment