1
Other / Re: I need a HELP!!
« on: September 04, 2011, 08:59:05 pm »- #include <iostream.h>
- int main()
- {
- int n, i, sum;
- cout << "Enter a value for n: ";
- cin >> n;
- sum = 0;
- i = 1;
- do
- {
- sum += i*i;
- i++;
- }while (i <= n);
- cout << "The sum of the first " << n
- << " numbers is " << sum << endl;
- return 0;
- }
This is my idea. Not yet compiled.