Find amount of water wasted after filling the tank | Function to calculate amount of wasted water ; filled amount of water in one minute ; total time taken to fill the tank because of leakage ; wasted amount of water ; Driver code
< ? php function wastedWater ( $ V , $ M , $ N ) { $ amt_per_min = $ M - $ N ; $ time_to_fill = $ V / $ amt_per_min ; $ wasted_amt = $ N * $ time_to_fill ; return $ wasted_amt ; } $ V = 700 ; $ M = 10 ; $ N = 3 ; echo wastedWater ( $ V , $ M , $ N ) , " STRNEWLINE " ; $ V = 1000 ; $ M = 100 ; $ N = 50 ; echo wastedWater ( $ V , $ M , $ N ) ;