Program to Compute LCM Using GCD # Python program to find the L.C.M. of two input number# This function computes GCDdefcompute_gcd(x, y):while(y): x, y = y, x % yreturnx# This function computes LCMdefcompute_lcm(x, y):lcm = (x*y)//compute_gcd(x,y)returnlcm num1 =54nu...
# Python program to find H.C.F of two numbers# define a functiondefcompute_hcf(x, y):# choose the smaller numberifx > y: smaller = yelse: smaller = xforiinrange(1, smaller+1):if((x % i ==0)and(y % i ==0)): hcf = ireturnhcf num1 =54num2 =24print("The H.C.F. ...
// Java program to find the // Lowest Common Multiple import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner SC = new Scanner(System.in); int num1 = 0; int num2 = 0; int rem = 0; int lcm = 0; int X = 0; int Y = 0; System.out...
Python program to add two matricesMat1 = () row = int(input("Enter Row : ")) col = int(input("Enter Cols : ")) print("Matrix 1 : ") for i in range(row): c=() for j in range(col): v=int(input("Enter Value {},{}:".format(i,j))) c+=(v,) Mat1 += (c,) ...
n2 : -n2; while(n1!=n2) { if(n1 > n2) n1 -= n2; else n2 -= n1; } printf("GCD = %d",n1); return 0; } Output Enter two integers: 81 -153 GCD = 9 You can also use recursion to find the GCD.Share on: Did you find this article helpful?
Write a function to add 10 to a given number. For example, for input 5, the output should be 15. Check Code Share on: Did you find this article helpful?Our premium learning platform, created with over a decade of experience and thousands of feedbacks. Learn and improve your coding ...
C program to make a beep sound C program to convert a given number of days into days, weeks, and years C program to find the roots of a quadratic equation C program to find the GCD (Greatest Common Divisor) of two integers C program to find the LCM (Lowest Common Multiple) of two ...
C - Find roots of a quadratic equation C - Find GCD (Greatest Common Divisor) of two integers C - Find LCM (Lowest Common Multiple) of two integers C - Calculate area of a triangle given three sides C - Calculate area of a triangle given base & height C - Calculate area of Trapezium...
Convert Decimal to Binary, Octal and Hexadecimal Find ASCII Value of Character Find HCF or GCD Find LCM Find the Factors of a Number Make a Simple Calculator Python Tutorials Python User-defined Functions Python Looping Techniques Python Numbers, Type Conversion and Mathematics Python ...
C program to make a beep sound C program to convert a given number of days into days, weeks, and years C program to find the roots of a quadratic equation C program to find the GCD (Greatest Common Divisor) of two integers C program to find the LCM (Lowest Common Multiple) of two ...