Find amount of water wasted after filling the tank | C ++ program to find the volume of water wasted ; 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
#include <iostream> NEW_LINE using namespace std ; double wastedWater ( double V , double M , double N ) { double wasted_amt , amt_per_min , time_to_fill ; amt_per_min = M - N ; time_to_fill = V / amt_per_min ; wasted_amt = N * time_to_fill ; return wasted_amt ; } int main ( ) { double V , M , N ; V = 700 ; M = 10 ; N = 3 ; cout << wastedWater ( V , M , N ) << endl ; V = 1000 ; M = 100 ; N = 50 ; cout << wastedWater ( V , M , N ) << endl ; return 0 ; }