Recent Posts
None | 30 sec ago
None | 1 min ago
C | 2 min ago
None | 3 min ago
Bash | 4 min ago
C++ | 4 min ago
Java | 4 min ago
None | 5 min ago
None | 5 min ago
JavaScript | 6 min ago
Sitereport
Find cool info about any domain on the internet?
visit sitereport
Free Subdomains
Want a pastebin.com sub-domain for your community?
learn more...
What is pastebin?
Pastebin is a website that hosts all your text & code on dedicated servers for easy sharing.
learn more...
Learn a little bit about the new Pastebin.com on our help page. hide message
By fxsdfsdfsdf on the 10th of Feb 2010 12:05:34 AM Download | Raw | Embed | Report
  1. #include <iostream>
  2. #include <stdlib.h>
  3. #include <stdio.h>
  4. using namespace std;
  5.  
  6. int squares(int num);
  7.  
  8. int main()
  9. {
  10.         int num;
  11.   int sqsum;
  12.  
  13.         cout << "Enter an integer larger than 1: " <<endl;
  14.   cin >> num;
  15.  
  16.   sqsum=squares(num);
  17.  
  18.   cout << "The input value is: " << num << endl;
  19.   cout << "The sum of the squares for " << num << " is " << sqsum << endl;
  20.   cout << endl;
  21.   cout << "Enter another integer: " <<endl;
  22.   cin >> num;
  23.  
  24. }
  25.  
  26. int squares(int num)
  27. {
  28.         int sum = 0;
  29.         sum = num*num;
  30.         if (num != 0)
  31.                 return (squares(num-1) + sum);
  32.  
  33. }
Submit a correction or amendment below. Make A New Post
To highlight particular lines, prefix each line with @h@
Syntax highlighting:
Post expiration:
Post exposure:
Name / Title:
Email: