Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int GCD(int p, int q)
    {
    int temp;
    while (q != 0)
    {
    temp = p % q;
    p = q;
    q = temp;
    }
    return(p);
    }
    int main ()
    {
    int m = 10, n = 120;
    cout << GCD(m, n);
    return(0);
    }
    1. 10
    2. 120
    3. Compilation Error
    4. Runtime Error
    5. None of these
Correct Option: A

In this program, we are finding the gcd of the number.



Your comments will be displayed only after manual approval.