找出能被5或6整除,但是不能被两者同时整除的数 Exercise05_11

 1 /**
 2  * @author 冰樱梦
 3  * 时间:2018年下半年
 4  * 题目:找出能被5或6整除,但是不能被两者同时整除的数
 5  *
 6  */
 7 public class Exercise05_11 {
 8     public static void main(String[] args){
 9         int count=0;
10         for(int i=101;i<200;i++){
11             if(i%5==0 && i%6==0) i++;
12             else if(i%5==0 || i%6==0){
13                 System.out.print(i+" ");
14                 count++;
15                 if(count%10==0) System.out.printf("\n");
16             }
17         }
18     }
19 }

猜你喜欢

转载自www.cnblogs.com/cherrydream/p/10173650.html
今日推荐