I really need the syntax or the code in C programming that after i enter ten (10) numbers, then i can get their sum. Please help me. Thank you so much. Godbless!!
What is the code in C programming that after i 10 numbers i could get their sum?
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
main()
{
clrscr();
int sum=0, num,avg;
printf("Enter 10 numbers");
for(i=0;i%26lt;=10;i++)
{
scanf("%d",%26amp;num);
sum=sum+num;
}
avg=sum/10;
printf("Sum = %d\nAverage =%d\n",sum,avg);
getch();
}
Reply:Has anyone seen a question more lame??Please let me know if you have...
Reply://heres what I would do:
int a^=a;for(int p=a;p%26lt;012;++p)a+=n[p];
//where n[] is your array of 10 numbers, and a is the total
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment