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<
In the first one you are executing cout<
In the second you are calling it every execution of the loop. That makes it print 1, then 3, then 6 ... always appending it, since there is no newline. As you can see you have 55 as last output.