Assume A and B are non-zero positive integers. The following code segment:…

ISRO Scientist/Engineer SC 2018

Assume A and B are non-zero positive integers. The following code segment:

while ( A != B){
     if ( A > B ) A - = B ;
     else B - = A ; 
} 
cout << A; // printing the value of A
  1. A.

    Computes the LCM of two numbers

  2. B.

    Divides the larger number by the smaller number

  3. C.

    Computes the GCD of two numbers

  4. D.

    Finds the smaller of two numbers

Attempted by 1093 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…