{I am going write the c program but before you need a c compiler(software).there are a lot of compilers(software). like Code::Blocks, dev c++ Download dev c++ its free and install it in your computer.open dev c++ go to file-->new-->source file.}
#include<stdio.h>
#include<conio.h>
main()
{
int a,b,x,y,t,r,lcm;
printf("enter first number\n");
scanf("%d",&a);
printf("enter second number\n");
scanf("%d",&b);
x=a;
y=b;
if(a<b)
{
t=a;
a=b;
b=t;
}
r=a%b;
while(r!=0)
{
a=b;
b=r;
r=a%b;
}
printf("\n %d is hcf",b);
lcm=(x*y)/b;
printf("\n %d is lcm",lcm);
getch();
}
For beginners
{After typing this program go to execute-->compile & run-->a window will pop-up-->give file name:(anything u like)-->save as type: c source files-->click save.}
IS IT HELPFIL? comment.
No comments:
Post a Comment