You are on page 1of 3

#include<stdio.

h>

#include<conio.h>

#include<math.h>

int main()

float p,T,rho,p0,T0,rho0,M;

int option;

printf("Enter the Mach Number \n");

scanf("%f",&M);

printf("Choose the calculation method \n");

printf("Option - 1: using static pressure and static density \n");

printf("Option - 2: using static pressure and static temperature \n");

printf("Option - 3: using static density and static temperature \n");

scanf("%d",&option);

switch(option)

case 1:

printf("Enter the value of static pressure and static density \n");

scanf("%f%f",&p,&rho);

T=p/(rho*287);

printf("The static temperature is %f \n",&T);

printf("The static pressure is %f \n",&p);

printf("The static density is %f \n",&rho);

T0=T*(1+0.2*M*M);

p0=p*pow((1+0.2*M*M),3.5);
rho0=p0/(287*T0);

printf("The stagnation temperature is %f \n",&T0);

printf("The stagnation pressure is %f \n",&p0);

printf("The stagnation density is %f \n",&rho0);

return 0;

break;

case 2:

printf("Enter the value of static pressure and static temperature \n");

scanf("%f%f",&p,&T);

rho=p/(T*287);

printf("The static temperature is %f \n",&T);

printf("The static pressure is %f \n",&p);

printf("The static density is %f \n",&rho);

T0=T*(1+0.2*M*M);

p0=p*pow((1+0.2*M*M),3.5);

rho0=p0/(287*T0);

printf("The stagnation temperature is %f \n",&T0);

printf("The stagnation pressure is %f \n",&p0);

printf("The stagnation density is %f \n",&rho0);

break;

case 3:

printf("Enter the value of static density and static temperature \n");

scanf("%f%f",&rho,&T);

p=rho*287*T;
printf("The static temperature is %f \n",&T);

printf("The static pressure is %f \n",&p);

printf("The static density is %f \n",&rho);

T0=T*(1+0.2*M*M);

p0=p*pow((1+0.2*M*M),3.5);

rho0=p0/(287*T0);

printf("The stagnation temperature is %f \n",&T0);

printf("The stagnation pressure is %f \n",&p0);

printf("The stagnation density is %f \n",&rho0);

break;

getch();

You might also like