#include<iostream>usingnamespace std;intmain(){int n,t,m=0,p;
cin>>n;
t = n;while(t >0){
p = t %10;
m += p*p*p;
t /=10;}if(m == n){
cout<<n<<"是水仙花数.";}return0;}
1.判断一个数是否为水仙花数,“水仙花数”是指一个三位数,其各位数字立方和等于该数本身。#include<iostream>using namespace std;int main(){ int n,t,m=0,p; cin>>n; t = n; while(t > 0){ p = t % 10; m += p*p*p; t /= 10; } if(m == n){ cout<<n<<"是水仙花数."; } re