...
Question 9522 – Programming
February 13, 2024
Question 9578 – Programming
February 13, 2024
Question 9522 – Programming
February 13, 2024
Question 9578 – Programming
February 13, 2024

Question 9529 – Programming

Consider the following C program

     main()
     {   int x, y, m, n;
         scanf ("%d %d", &x, &y);
         /* Assume x > 0 and y > 0  */
         m = x; n = y;
         while (m! = n)
            {    if (m > n)
                   m = m - n;
                 else
                   n = n - m;
            } 
          print f ("% d", n);
          }

The program computes

Correct Answer: C

Question 44 Explanation: 
Given code is same as Euclid’s Algorithm for finding Greatest Common Divisor(GCD).
A
x + y using repeated subtraction
B
x mod y using repeated subtraction
C
the greatest common divisor of x and y
D
the least common multiple of x and y

Leave a Reply

Your email address will not be published. Required fields are marked *