/* Uses a for loop to compute the sum of the first n squares. */ #include void main () { int sum = 0, n=50; for (int i=1; i <= n; i++) sum += i*i; cout << "The sum of the first " << n << " squares is " << sum << ".\n"; }