#include <stdio.
h>
#include <math.h>
#define PI 3.14159265
// Function to calculate the flow rate
double calculateFlowRate(double d1, double d2, double h, double Cd) {
double A1 = PI * pow(d1 / 2.0, 2); // Area of larger section
double A2 = PI * pow(d2 / 2.0, 2); // Area of throat section
double g = 9.81; // Acceleration due to gravity in m/s^2
// Using Bernoulli's equation and continuity equation to calculate flow rate
double flowRate = Cd * A2 * sqrt(2 * g * h / (1 - pow(A2 / A1, 2)));
return flowRate;
int main() {
double d1, d2, h, Cd;
// Input the values
printf("Enter the diameter of the larger section (d1) in meters: ");
scanf("%lf", &d1);
printf("Enter the diameter of the throat section (d2) in meters: ");
scanf("%lf", &d2);
printf("Enter the differential height (h) in meters: ");
scanf("%lf", &h);
printf("Enter the discharge coefficient (Cd): ");
scanf("%lf", &Cd);
// Calculate the flow rate
double flowRate = calculateFlowRate(d1, d2, h, Cd);
// Output the result
printf("The flow rate of the liquid through the venturimeter is: %lf cubic meters per second\n",
flowRate);
return 0;