Check if it is possible to draw a straight line with the given direction cosines | C # implementation of the approach ; Function that returns true if a straight line is possible ; Driver code
using System ; class GFG { static bool isPossible ( float x , float y , float z ) { float a = x * x + y * y + z * z ; if ( Math . Ceiling ( a ) == 1 && Math . Floor ( a ) == 1 ) return true ; return false ; } public static void Main ( ) { float l = 0.70710678f , m = 0.5f , n = 0.5f ; if ( isPossible ( l , m , n ) ) Console . WriteLine ( " Yes " ) ; else Console . WriteLine ( " No " ) ; } }