Write a program to input 2 numbers and print its HCF using long division method while loop
Answers
Answered by
1
Answer:
#include <stdio.h>
int main()
{
int m, n, a, b, t, lc; // variable declaration
printf(" Enter two numbers: ");
scanf("%d%d", &a, &b);
m = a;
n = b;
while (n != 0)
{
t = n;
n = m % n;
m = t;
}
lc = (a*b)/hc; // lcm
printf(" The Least Common Multiple of %d and %d = %d\n", a, b, lc);
return 0;
}
Similar questions