HCF and LCM using recursion in C#

The following code explains how to calculate HCF and LCM using C# with recursive calling.

using System;
using System.Text;

namespace forgetCode
{

   class program
    {        
        public static void Main()
        {
            long x, y, hcf, lcm;

            
            Console.WriteLine("Enter two integers");
            x = Convert.ToInt64(Console.ReadLine());
            y = Convert.ToInt64(Console.ReadLine());

            hcf = gcd(x, y);
            lcm = (x * y) / hcf;

            Console.WriteLine("Greatest common divisor of {0} and {1} = {2}\n", x, y, hcf);
            Console.WriteLine("Least common multiple of {0} and {1} = {2}\n", x, y, lcm);
            

        }

       static long gcd(long a, long b)
       {
           if (b == 0)
           {
               return a;
           }
           else
           {
               return gcd(b, a % b);
           }
       }

    }
}


Output:

Enter two integers
8
12
Greatest common divisor of 8 and 12 = 4

Least common multiple of 8 and 12 = 24