Created
July 17, 2016 13:57
-
-
Save Jack-Saleem/53ea6ea4a7fff7aa4dc3c063cfe7a050 to your computer and use it in GitHub Desktop.
codeforces 80A PanoramixsPrediction program in java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class PanoramixsPrediction | |
{ | |
public static void main(String[] args) | |
{ | |
Scanner z=new Scanner(System.in); | |
int n=z.nextInt(); | |
int m=z.nextInt(); | |
int a=0; | |
for (int i=n+1;i<=500;i++) { | |
int x=0; | |
for(int j=2;j<=i/2;j++) { | |
if(i%j==0) | |
x++; | |
} | |
if(x==0) { | |
if(i==m) { | |
System.out.println("YES"); | |
break; | |
} else { | |
System.out.println("NO"); | |
break; | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment