text: Minimum time required to fill a cistern using N pipes | C # implementation of above approach ; Function to calculate the time ; Driver Code
code: using System ; class GFG { static float Time ( float [ ] arr , int n , float Emptypipe ) { float fill = 0 ; for ( int i = 0 ; i < n ; i ++ ) fill += 1 / arr [ i ] ; fill = fill - ( 1 / ( float ) Emptypipe ) ; return 1 / fill ; } public static void Main ( ) { float [ ] arr = { 12 , 14 } ; float Emptypipe = 30 ; int n = arr . Length ; Console . WriteLine ( ( int ) ( Time ( arr , n , Emptypipe ) ) + " ▁ Hours " ) ; } }