I\'m a newbie. Wrote a code to print sum of number from 1 to 10. Here\'s what happened;
for(a = 1; a<=10; a++) sum += a; cout<
because:
is like saying:
for(a = 1; a<=10; a++) { sum += a; } cout<
When you do this, it prints the number once rather than upon each iteration.