# 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. ...
println!("The HCF of {0} and {1} is {2}.", a, b, res); } Output: The HCF of 36 and 48 is 12. Explanation: In the above program, we created two functionscalculateHCF()andmain(). ThecalculateHCF()function is a recursive function, which is used to calculate the HCF of two ...
The source code to calculate the HCF is given below. The given program is compiled and executed successfully.// Rust program to calculate the HCF. use std::io; fn main() { let mut n1:u32 = 0; let mut n2:u32 = 0; let mut temp:u32 = 0; let mut input1 = String::new(); ...