Subscribe Us

Responsive Advertisement

Advertisement

URI Online Judge | 2116 Students Game solution in cpp


uri 2116 solution in cpp

by ujjal roy



#include<bits/stdc++.h>

using namespace std;

int prime(int p)

{

    int i,j,pr,c;

    for(i=p;i>=2;i--)

    {  c=0;

        for(j=2;j<=sqrt(i);j++)

        {

            if(i%j==0)

            {   c=1;

                break;

            }


        }

        if( c==0)

        {

            return i;

        }

    }

}

main()

{

   int n,m,p;

    cin>>n>>m;

    p=prime(n)*prime(m);

    cout<<p<<endl;


    return 0;


}

 

Post a Comment

0 Comments