Skip to content

Instantly share code, notes, and snippets.

@Jack-Saleem
Created July 17, 2016 13:57
Show Gist options
  • Save Jack-Saleem/53ea6ea4a7fff7aa4dc3c063cfe7a050 to your computer and use it in GitHub Desktop.
Save Jack-Saleem/53ea6ea4a7fff7aa4dc3c063cfe7a050 to your computer and use it in GitHub Desktop.
codeforces 80A PanoramixsPrediction program in java
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