Program to find GCD of floating point numbers | C # code for finding the GCD of two floating numbers . ; Recursive function to return gcd of a and b ; base case ; Driver Function .
using System ; class GFG { static float gcd ( double a , double b ) { if ( a < b ) return gcd ( b , a ) ; if ( Math . Abs ( b ) < 0.001 ) return ( float ) a ; else return ( float ) ( gcd ( b , a - Math . Floor ( a / b ) * b ) ) ; } public static void Main ( ) { double a = 1.20 , b = 22.5 ; Console . WriteLine ( gcd ( a , b ) ) ; } }