Sum of squares program

So this is my assignment...
http://gyazo.com/73a8bc23ed03a5dd49413d226befcc3f
And this is the code I have so far.
Can someone tell me if I'm on the right path?


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
  #include <iostream>
using namespace std;


int print(int x){
	int sum=0;
	for (int i=2; i<=x; i++) {
		if (i%2==0) {
			i*i;
			
		}
		sum+=i;
		cout << sum <<endl;
	}


}


int main(){

	int n;
	
	cout << "Enter a number" <<endl;
	cin>>n;
	
	
	print(n);

	
}
9
10
11
12
13
sum += i * i;

    }
}
cout << sum <<endl;
Last edited on
Topic archived. No new replies allowed.