本文共 709 字,大约阅读时间需要 2 分钟。
public class j5_10 { public static void main(String[] args) { // TODO Auto-generated method stub int counter = 0; for(int i = 100;i<=1000;i++) { if(i %5 == 0 && i %6 == 0) { System.out.printf("%4d",i); counter ++; } if(counter %10==0 && counter >1) { System.out.printf("\n"); counter = 0; } } }}
public class J5_11 { public static void main(String[] args) { // TODO Auto-generated method stub int counter = 0; for(int i = 100;i<=200;i++) { if(i %5 == 0 && i %6 == 0) { continue; } else if(i % 5 ==0 || i % 6 ==0) { System.out.printf("%4d",i); counter ++; } if(counter %10==0 && counter >1) { System.out.printf("\n"); counter = 0; } } } }
转载地址:http://bubrn.baihongyu.com/