- Trending Categories
- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies

- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who

# Find amount of water wasted after filling the tank in C++

In this tutorial, we are going to solve the following problem.

Given a tank with a capacity of N liters and a pump that fill the tank with S speed per minute. Unfortunately, there is a hole in the tank. And water is wasting at a speed of WS per minute while filling it.

We need to calculate the amount of water wasted for a full tank.

The amount of water filled per minute is equal to the difference between the water filling water and wasting water speed.

Hence we can get the total time to fill the water tank by dividing the capacity of the water tank by the filling speed per minute.

And we can easily get the wastage of water by multiplying the wasting water speed with the time to fill the water tank.

## Example

Let's see the code.

#include <iostream> using namespace std; double countTheWastedWater(double N, double S, double WS) { double wasted_water, fill_per_minute, time_to_fill; fill_per_minute = S - WS; time_to_fill = N / fill_per_minute; wasted_water = WS * time_to_fill; return wasted_water; } int main() { double N, S, WS; N = 275; S = 10; WS = 3; cout << countTheWastedWater(N, S, WS) << endl; return 0; }

## Output

If you execute the above program, then you will get the following result.

117.5

## Conclusion

If you have any queries in the tutorial, mention them in the comment section.

- Related Articles
- A water tank contains 400 litres of water. 120 litres of water is taken out of it. Find the percentage decrease in the amount of water.
- Program to check if water tank overflows when n solid balls are dipped in the water tank in C++
- C++ program to find maximum possible amount of allowance after playing the game
- A water tank contains 6500 litre of water during transit to a nearby society. 3 by 16 of the water was spilled, find the volume of water in the tank that finally reached the society.
- If a tank is filled with $frac{1}{3}$% of water and there are only 27 litres of water in the tank, what is the total capacity of tank?
- Find the lateral curved surface area of a cylindrical petrol storage tank that is $4.2 m$ in diameter and $4.5 m$ high. How much steel was actually used, if $frac{1}{12}$ of steel actually used was wasted in making the closed tank?
- From a tank, completely filled to its brim, water equal to $frac{2}{5}$ of its capacity was taken out. 130 litres of water was added to the tank leaving it only $frac{1}{6}$ empty. Find the capacity of the tank.
- A tank had 500 l of water. A family use one-fifth of the water. How much water was left?
- Find(i) the lateral or curved surface area of a closed cylindrical petrol storage tank that is ( 4.2 mathrm{~m} ) in diameter and ( 4.5 mathrm{~m} ) high(ii) how much steel was actually used, if ( frac{1}{12} ) of the steel actually used was wasted in making the tank.
- Program to find the formatted amount of cents of given amount in Python
- The capacity of a cuboidal tank is 50000 litres of water. Find the breadth of the tank, if its length and depth are respectively ( 2.5 mathrm{~m} ) and ( 10 mathrm{~m} ).
- A water tanker filled up to two-thirds of its tank with water is running with a uniform speed. When the brakes are suddenly applied, the water in its tank would:$(a)$. move backward$(b)$. move forward$(c)$. rise upwards$(d)$. remain unaffected
- In a rain-water harvesting system, the rain-water from a roof of $22 m x 20 m$ drains into a cylindrical tank having diameter of base 2 and height $3.5 m$. If the tank is full, find the rainfall in cm. Write your views on water conservation.
- Two water taps together can fill a tank in $9frac{3}{8}$ hours. The tap of the larger diameter takes 10 hours less than the smaller one to fill the tank separately. Find the time in which each tap can separately fill the tank.
- Two water taps together can fill a tank in $9frac{3}{8}$ hours. The tap of larger diameter takes 10 hours less than the smaller one to fill the tank separately. Find the time in which each tap can separately fill the tank.