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 program code in C programming that when i after i 10 numbers i could get the sum?
#include%26lt;stdio.h%26gt;
#include%26lt;conio.h%26gt;
main()
{
clrscr();
int sum= 0,num;
printf("Enter 10 numbers");
for(i=0;i%26lt;=10;i++)
{
scanf("%d",%26amp;num);
sum = sum + num;
}
printf("Total Sum = %d",sum);
getch();
}
this program wat it does is it keeps adding the numbers as soon as you input them and so at the end when u tell it to output the value of sum u get the total sum of all the numbers that u entered.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment