Computer Science, asked by VaniSna, 9 months ago

Write a programe in java to input two no. and check wheaten they are coprimeor not

Answers

Answered by Vyomsingh
2

Answer:

class coprime

{

static void main(int n,int m)

{

int k=Math.min(n,m);

int v=0;

for(int a=1;a<=k;a++)

{

if(n%a==0&&m%a==0)

{

v++;

}

}

if(v==1)

{

System.out.print ("Not a co-prime");

}

else

System.out.println ("Co-prime");

}

}

Similar questions