Write a programe in java to input two no. and check wheaten they are coprimeor not
Answers
Answered by
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
Math,
4 months ago
India Languages,
4 months ago
Social Sciences,
9 months ago
Business Studies,
1 year ago