public class Test03 {
public static void main(String[] args) {
//报数游戏,100以内的逢7过
for (int i = 1;i<=100;i++){
if (i%7 == 0 | i%10 ==7 | i/10 ==7){
System.out.println("黑马 ");
}else {
System.out.println(i+" ");
}
}
}
}
报数游戏(1-100),遇到数字中包含 7 和 7 的倍数时需要跳过喊黑马,然后接着输出后续的数字。
猜你喜欢
转载自blog.csdn.net/lzj_love_wx/article/details/114335167
今日推荐
周排行