c - Explain the working of a program that prints the GCD and LCD of two numbers -
I know that this is very easy, but I do not know that for variable If I remove the variable This is Euclid's algorithm for calculating GCD. This argument reduces the value of A and B. T is a dummy variable that captures the value of B, while the next new value of B is being calculated. The amount which will also decrease, eventually we will be able to eliminate the algorithm with the necessary result. t What is
int main () {int a, b, x, y, t, gcd, lcm; Printf ("Enter two integers \ n"); Scanf ("% d% d", & amp; x, & amp; y); A = x; B = Y; While (B! = 0) {t = b; B = A% B; A = T; } GCD = A; LCM = (x * y) / gcd; Printf ("% d and% d =% d \ n", the largest general separator for X, Y, GCD); Printf ("% d and% d =% d \ n", at least normal multiple of x, y, LCM); Return 0; }
t , then the input must be given in order to reduce (i.e. the input first). If
t is used then everything works fine. I am very new to programming so please help.
function gcd (a, b) {while (bce? 0) {t: = b; B: = A modern T; A: = t; } Return}
Comments
Post a Comment