Sign in with
Sign up | Sign in
Your question

C++ problem

Last response: in Applications
Share
April 1, 2012 7:56:18 PM

Write a program that prompts the user to enter two positive integers lower and upper, then finds and prints all numbers in the interval [lower, upper] that have the property that the cube sum of the digits equals the number itself. The program also prints the how many numbers have the cube sum property.

More about : problem

April 1, 2012 9:02:29 PM

#include<iostream>
using namespace std;
void "insert function name" (int lower, int upper){
int i,n;
n=0;
for(i=lower;i<=upper;i++){
if(digitcubesum( i )==i){
n++;
cout<<i<<endl;
}
}
cout<<"this many numbers completed the trial of fire"<<n<<endl;
}
int digitcubesum(int n){
int result=0;
int i;
i=n;
while(i>0){
result+=i%10;
i=i/10;
}
return result*result*result;
}

int main(){
int lw,up;
cout<<"Insert numero uno"<<endl;
cin>>lw;
cout<<"Insert number two"<<endl;
cin>>up;
"insert name of your primary function, same as above"(lw,up);
return 0;
}
a b L Programming
April 2, 2012 5:57:57 AM

Please do your own homework.
!