Time until distance gets equal to X between two objects moving in opposite direction | C # implementation of the approach ; Function to return the time for which the two policemen can communicate ; time = distance / speed ; Driver code
using System ; class GFG { static double getTime ( int u , int v , int x ) { double speed = u + v ; double time = x / speed ; return time ; } public static void Main ( ) { int u = 3 , v = 3 , x = 3 ; Console . WriteLine ( getTime ( u , v , x ) ) ; } }