Program to find HCF ( Highest Common Factor ) of 2 Numbers | C # program to find GCD of two numbers ; Recursive function to return gcd of a and b ; Driver method
using System ; class GFG { static int gcd ( int a , int b ) { if ( b == 0 ) return a ; return gcd ( b , a % b ) ; } public static void Main ( ) { int a = 98 , b = 56 ; Console . WriteLine ( " GCD ▁ of ▁ " + a + " ▁ and ▁ " + b + " ▁ is ▁ " + gcd ( a , b ) ) ; } }