write the java program for no. 5
Attachments:
Answers
Answered by
1
hiii friend
here is your answer
class
{psvm (int a, int b)
if (a>b)
int dividend =a;
int divisor =b;
else
int dividend =b;
int divisor =a;
int r=1;
while(r!=0)
{
r=dividend%divisor;
dividend = divisor;
divisor = r;
}
int lcm=(aĆb)/r;
sopln ("l.c.m. of" + a + "and" + b + "=" +lcm);
}
glad to help you
hope it helps
thank you.
here is your answer
class
{psvm (int a, int b)
if (a>b)
int dividend =a;
int divisor =b;
else
int dividend =b;
int divisor =a;
int r=1;
while(r!=0)
{
r=dividend%divisor;
dividend = divisor;
divisor = r;
}
int lcm=(aĆb)/r;
sopln ("l.c.m. of" + a + "and" + b + "=" +lcm);
}
glad to help you
hope it helps
thank you.
Similar questions