import java.io.*;
public class question06 {
public static void main(String args[])throws IOException {
BufferedReader buf=new BufferedReader(new InputStreamReader(System.in));
System.out.print("請輸入數字1(1~1500):");
int a=Integer.parseInt(buf.readLine());
System.out.print("請輸入數字2(1~1500):");
int b=Integer.parseInt(buf.readLine());
int j=0;
int k=0;
if (a>b) {for(int i=b;i if ((i%3==0)&&(i%5==0)) j=j+1;
if ((i%5==0)||(i%7==0)) k=k+1;
}
}
if (a if ((i%3==0)&&(i%5==0)) j=j+1;
if ((i%5==0)||(i%7==0)) k=k+1;
}
}
System.out.println("兩數之間3及5的倍數有"+j+"個");
System.out.println("兩數之間5或7的倍數有"+k+"個");
}
}
留言列表