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 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; }   

If I remove the variable 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.

This is Euclid's algorithm for calculating GCD.

  function gcd (a, b) {while (bce? 0) {t: = b; B: = A modern T; A: = t; } Return}   

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.

Comments

Popular posts from this blog

excel vba - How to delete Solver(SOLVER.XLAM) code -

github - Teamcity & Git - PR merge builds - anyway to get HEAD commit hash? -

ios - Replace text in UITextView run slowly -