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...
By fxsdfsdfsdf on the 10th of Feb 2010 12:05:34 AM
Download |
Raw |
Embed |
Report
#include <iostream>
#include <stdlib.h>
#include <stdio.h>
using namespace std;
int squares(int num);
int main()
{
int num;
int sqsum;
cout << "Enter an integer larger than 1: " <<endl;
cin >> num;
sqsum=squares(num);
cout << "The input value is: " << num << endl;
cout << "The sum of the squares for " << num << " is " << sqsum << endl;
cout << endl;
cout << "Enter another integer: " <<endl;
cin >> num;
}
int squares(int num)
{
int sum = 0;
sum = num*num;
if (num != 0)
return (squares(num-1) + sum);
}
Submit a correction or amendment below.
Make A New Post