Share Pastebin
Guest
Public paste!

nadeeeee

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 0.50 KB | Hits: 10 | Expires: Never
Copy text to clipboard
  1.  
  2. #include <iostream>
  3. #include <stdlib.h>
  4. #include <stdio.h>
  5.  
  6. using namespace std;
  7.  
  8. int squares(int n);
  9. int main()
  10. {
  11.         int n, squares;
  12.         cout << "Enter an integer larger than 1: " <<endl;
  13.   cin >> n;
  14.  
  15.   squares()
  16.  
  17.   cout << "The sum of the squares for " << n << " is " << squares << endl;
  18.  
  19.   //printf("The sum of squares for %d is %d: \n",n,squares(n));
  20.  
  21. system("Pause");
  22. }
  23.  
  24. int squares(int n)
  25. {
  26.         int sum = 0;
  27.         sum = n*n;
  28.         if (n != 0)
  29.                 return (squares(n-1) + sum);
  30.  
  31.  
  32.  
  33. }