for (int i = 1; i <= 100; i++) {
if(i%3==0 && i%7==0){
System.out.println(i);
}
}
public class four_3 {
public static void main(String[] args) {
final int x1=3;
final int x2=7;
int m=x1;
int n=x2;
int max,r,lcm,common=1;
if(m>n) {
max=m;
m=n;
n=max;
}
r=n%m;
while(r!=0) {
n=m;
m=r;
r=n%m;
}
lcm=(x1/m)*x2;
System.out.print("1~100之间既可以被"+x1+"整除又可以被"+x2+"整除的数:");
for(int i=1;common<=100;i++) {
common=lcm*i;
if(common<=100) System.out.print("\t"+common);
}
}
}
public class c {
public static void main(String[] args) {
for(int i=10;i<100;i++){
if(i%7==0&&i%3==0){
System.out .println(i);
}
}
}}
for (int i = 1;i<101;i++){
if (i%3==0 && i%7==0){
System.out.println(i);
}
}