1)打印1~100之间 6的倍数的个数
2)求出1~100之间,既是3又是7的倍数的自然数出现的次数?
class Exer1{
public static void main(String[] args) {
int count1 = 0, count2 = 0;
for (int x = 1;x <= 100;x++){
if(x % 6 ==0){
count1++;
}
if (x % 3 == 0 && x % 7 ==0){
count2++;
}
}
System.out.println("6的倍数的个数=" + count1);
System.out.println("既是3又是7的倍数的个数=" + count2);
}
}