Practice programming with C. This small program shows and practice the usage of C variables, user input and output using printf
and scanf
and the control structure while loop
.
This is a program for calculating water depth in a open channel flow for rectangular section channel. The inputs are:
discharge
- The flow rate in m^3/s
n_manning
- n. The Manning's roughness coefficient
channel_slope
- The slope of the channel bed in m/m
base_width
- The width of the channel in meters
The output is the computed water_depth
or the depth of the water in the channel in meters
.
To compare the 2 languages for performance, use the file flow_python.py
for python, just run it using python 3 version. For the
C counterpart, compile and run the code flow_c.c
.