Find probability that a player wins when probabilities of hitting the target are given | C # mplementation of the approach ; Function to return the probability of the winner ; Driver Code ; Will print 9 digits after the decimal point
using System ; class GFG { static double find_probability ( double p , double q , double r , double s ) { double t = ( 1 - p / q ) * ( 1 - r / s ) ; double ans = ( p / q ) / ( 1 - t ) ; return ans ; } public static void Main ( ) { double p = 1 , q = 2 , r = 1 , s = 2 ; Console . WriteLine ( find_probability ( p , q , r , s ) ) ; } }