习题2_2韩信点兵
package 第二章习题;
import java.util.Scanner;
public class 习题2_2韩信点兵 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
int c=in.nextInt();
int flag=0;
for(int i=10;i<=100;i++) {
if(i%3==a&&i%5==b&&i%7==c) {
System.out.println(i);
flag=1;
break;
}
}
if(flag==0) {
System.out.println("No answer");
}
}
}
import java.util.Scanner;
public class 习题2_2韩信点兵 {
public static void main(String[] args) {
// TODO Auto-generated method stub
Scanner in=new Scanner(System.in);
int a=in.nextInt();
int b=in.nextInt();
int c=in.nextInt();
int flag=0;
for(int i=10;i<=100;i++) {
if(i%3==a&&i%5==b&&i%7==c) {
System.out.println(i);
flag=1;
break;
}
}
if(flag==0) {
System.out.println("No answer");
}
}
}