/**
* @Author:
* @Date:2023/3/16 10:42
*/
public class DemoFilpFlop {
public static void main(String[] args) {
/**
* 1-100数字
* 3的倍数,输出Filp
* 5的倍数,输出Flop
* 既是3又是5的倍数,输出FilpFlop
*/
int num = 1;//数字
String answer = "";//输出
for (; num <= 100; num++) {
if (num % 3 == 0 && num % 5 == 0) {
answer = "FilpFlop";
}else
if (num % 5 == 0) {
answer = "Flop";
}else
if (num % 3 == 0 ) {
answer = "Filp";
}else {
answer="";
}
System.out.println("数字对应的符号:" + num + answer);
}
}
}
第六章输出FilpFlop
最新推荐文章于 2024-08-29 18:44:48 发布