import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("请输入一个三位数:");
int str=scan.nextInt();
System.out.println(Issx(str));
}
private static boolean Issx(int str) {
boolean flag=false;
int s = 0;
int temp=str;
int temp2=str;
int num=10;
int count=0;
while(temp!=0){
temp=temp/10;
s++;
}
for(int i=0; i<s;i++){
temp=temp2%num;
temp2 /=10;
count+=temp*temp*temp;
System.out.println(count+"--"+temp);
}
if(count==str)
flag=true;
return flag;
}
}
判断水仙花数
最新推荐文章于 2023-09-04 12:27:47 发布