80A - Panoramix's Prediction

80A - Panoramix's Prediction

#include<iostream>
using namespace std;
int primechecker(int n){
 int i;
 bool f =true;
 for(int i=2;i<n ;i++)
    if(n%i==0) {  f = false;  }
   if(f) return 1;
   else return 0;

    }
int main()
  {
   int n,m,result;
   cin>>n>>m;
    for(int i=0;i<50;i++){
   n++;
   if(primechecker(n)==1) { result = n; break;}

   }
   if(result==m) cout<<"YES";
   else cout<<"NO";
   }


Comments

Popular posts from this blog

Codeforce Problem 1703A. YES or YES?

Aptitude test assistant programmer 2018

1041A. Heist solution