#include<stdio.h>
main()
{
int a,b,temp,i;
printf("\nEnter two numbers=");
scanf("%d%d",&a,&b);
if(a>b)
{
temp=a;
a=b;
b=temp;
}
for(i=a;i>=1;i--)
{
if(a%i==0 && b%i==0)
{
break;
}
}
printf("\nHCF=%d",i);
printf("\nLCM=%d",a*b/i);
}
main()
{
int a,b,temp,i;
printf("\nEnter two numbers=");
scanf("%d%d",&a,&b);
if(a>b)
{
temp=a;
a=b;
b=temp;
}
for(i=a;i>=1;i--)
{
if(a%i==0 && b%i==0)
{
break;
}
}
printf("\nHCF=%d",i);
printf("\nLCM=%d",a*b/i);
}
No comments:
Post a Comment