public class hcf
{
public static void hcf_lcm(int n,int m)
{
int hcf,lcm,r,k=1;
while(n>0)
{
r=m%n;
if(r==0)
{
hcf=n;
k=hcf;
}
else
{ n=m;
n=r;
}
lcm=n*m/k;
System.out.println("the hcf of no."+ k);
System.out.println("the lcm of no."+ lcm);
}
}
}
//editor used - IntelliJ IDEA package ToyStore; import javax.swing.*; import java.awt.event.*; import java.util.Scanner; //here you can edi...
No comments:
Post a Comment