Program to calculate HCF and LCM (java).
This program is helpful for all computer students.
//Created and posted by Subrata Sir(HOD,East West Model School)
//Website:-subrataray.hpage.com
class number
{
int hcf,lcm,p;
public void display(int a,int b)
{
p=a*b;
for(int i=1;i<=p;i++)
{
if(a%i==0)
{
hcf=i;
}
}
lcm=p/hcf;
System.out.println("hcf="+hcf);
System.out.println("lcm="+lcm);
}
}