求次方:pow()函数,函数头文件math.h
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n = 100;
do {
if (n==pow(n/100,3)+pow(n/10%10,3)+pow(n%10,3))
cout<<n<<endl;
n++;
} while (n<1000);
}
求次方:pow()函数,函数头文件math.h
#include<iostream>
#include<math.h>
using namespace std;
int main(){
int n = 100;
do {
if (n==pow(n/100,3)+pow(n/10%10,3)+pow(n%10,3))
cout<<n<<endl;
n++;
} while (n<1000);
}