| 1234567891011121314151617181920 |
- /**
- * @author WanJl
- * @version 1.0
- * @title HomeWork04
- * @description 7月14日课后作业-水仙花数
- * @create 2026/7/15
- */
- public class HomeWork04 {
- public static void main(String[] args) {
- int number=153; //定义一个整数变量
- int bai=number/100; //百位
- int shi=number/10%10; //十位
- int ge=number%10; //个位
- if (number==bai*bai*bai+shi*shi*shi+ge*ge*ge){
- System.out.println(number+"是水仙花数");
- }else {
- System.out.println(number + "不是水仙花数");
- }
- }
- }
|