Gate CS-2004 Question Paper With Solutions

Q. 82 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;
        }
    printf("%d", n);
}

The program computers

Gate CS-2004 Question Paper With Solutions

Answer: (C)

Explanation:

Gate CS-2004 Question Paper With Solutions

Learn More:   Gate ME-2020-2 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here