java - while 16

 

 

package com.demo.test;

public class whileDemo {
public static void main(String[] args) {
// 水仙花案例
int i = 100;
while (i<=999){
int individual = i % 10;
int ten = i / 10 % 10;
int hundred = i / 100;
if (individual*individual*individual + ten*ten*ten+hundred*hundred*hundred == i){
System.out.println(i);
}
// i++不能遗漏
i++;
}
    
int j = 1;
do {
System.out.println("666");
j++;
}while (j<=5);

}
}

  

posted @ 2023-03-02 15:15  文采呱呱  阅读(14)  评论(0编辑  收藏  举报