import java.util.Scanner; /** * @description: * @author: wmf * @create: 2022-10-13 14:21 **/ public class TestMain { public static void main(String[] args) { Scanner myscanner = new Scanner(System.in); System.out.println("请输入数字"); // 提示用户输入 while(true){ int number = myscanner.nextInt(); // 接收用户输入 int number1 = number / 100; // 取百位 int number2 = number % 100 / 10; // 取十位 int number3 = number % 10; // 取个位 if (number1 * number1 * number1 + number2 * number2 * number2 + number3 * number3 * number3 == number) { System.out.println(number + "是水仙花数"); } else { System.out.println(number + "不是水仙花数"); } } } }