include<iostream>
is wrong. It should be
#include <iostream>
Also try separating the declarations of count and sum onto two different lines, and the cin and cout (just below the line where number is declared) onto two different lines. It's better style and it might be necessary for some, if not all, compilers.
I don't see why you use this, though:
sum = sum + ((number+1)*number) - count;
You should just replace that with:
sum = sum + count;
Finally, add this just before the 'return 0;' line:
cin.get();
Compile the code with all the above changes and run it. If it closes the console window automatically before you can see the output, add another cin.get(); below the first one, then compile and run again. It should work.
|