楼主 希望你结贴 哈才来的 需要分呀
#include <iostream>
using namespace std;
int main()
{
int n,m;
for (int i = 1; i <= 9; i++)
{
for (int j = 0; j <= 9; j++)
{
for (int k = 0; k <= 9; k++)
{
n = i * 100 + j * 10 + k;
m = i * i * i + j * j * j + k * k * k;
if (n == m)
{
cout << n << ":" << "是水仙花数" << endl;
}
}
}
}
return 0;
}
VC 6.0编译给点分啦哈
楼主 希望你结贴 哈才来的 需要分呀
#include
using namespace std;
int main()
{
int n,m;
for (int i = 1; i <= 9; i++)
{
for (int j = 0; j <= 9; j++)
{
for (int k = 0; k <= 9; k++)
{
n = i * 100 + j * 10 + k;
m = i * i * i + j * j * j + k * k * k;
if (n == m)
{
cout << n << ":" << "是水仙花数" << endl;
}
}
}
}
return 0;
}
VC 6.0编译给点分啦哈