Computer Science, asked by sabajaved91749, 6 hours ago

Write a program to evaluate H.C.F of two positive integers in BASIC​

Answers

Answered by anishsingh14125
1

Answer:

Input two numbers from user. Store them in some variable say num1 and num2 . Declare and initialize a variable to hold hcf i.e. hcf = 1 . ... Inside the loop check if i is a factor of two numbers i.e. if i exactly divides the given two numbers num1 and num2 then set i as HCF i.e. hcf = i .

Hope it's help you

Answered by ayesha7861968
0

Answer:

HCF of two numbers in C

•int main() { int a, b, x, y, t, gcd, lcm;

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);•a = x; b = y;

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);•a = x; b = y;•while (b != 0) { t = b; ...

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);•a = x; b = y;•while (b != 0) { t = b; ...•gcd = a; lcm = (x*y)/gcd;

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);•a = x; b = y;•while (b != 0) { t = b; ...•gcd = a; lcm = (x*y)/gcd;•printf("Greatest common divisor of %d and %d = %d\n", x,

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);•a = x; b = y;•while (b != 0) { t = b; ...•gcd = a; lcm = (x*y)/gcd;•printf("Greatest common divisor of %d and %d = %d\n", x, •y, gcd); ...

•int main() { int a, b, x, y, t, gcd, lcm;•printf("Enter two integers\n"); scanf("%d%d", &x, &y);•a = x; b = y;•while (b != 0) { t = b; ...•gcd = a; lcm = (x*y)/gcd;•printf("Greatest common divisor of %d and %d = %d\n", x, •y, gcd); ...•return 0;

Similar questions