c++ finding gcd

#include <iostream>

// Function to find the greatest common divisor (GCD) of two numbers
int findGCD(int a, int b) {
    while (b != 0) {
        int temp = b;
        b = a % b;
        a = temp;
    }
    return a;
}

// Main function to demonstrate the GCD calculation
int main() {
    int num1, num2;

    // Input the two numbers
    std::cout << "Enter first number: ";
    std::cin >> num1;
    std::cout << "Enter second number: ";
    std::cin >> num2;

    // Calculate and display the GCD
    int gcd = findGCD(num1, num2);
    std::cout << "GCD of " << num1 << " and " << num2 << " is: " << gcd;

    return 0;
}