As we know the Vander Waals equation -
Now, first we have to make flow chart for our program as below -
Start
Input a,b,R
Input n, V, T
Calculate pressure using Van der Waals equation
P = (n * R * T) / (V - n * b) - (a * n *n)/(V * V)
Print the pressure
End
Program -
#includemain() #include void main() { float a,b,r,n,v,t,p; clrscr(); printf("\n Enter the value of 'a' for the given gas"); scanf("%f",&a); printf("\n Enter the value of 'b' for the given gas"); scanf("%f",&b); printf("\n Enter the value of Gas Constant"); scanf("%f",&r); printf("\n Enter the value of moles of the given gas"); scanf("%f",&n); printf("\n Enter the value of Volume for the given gas"); scanf("%f",&v); printf("\n Enter the value of Temperature for the given gas"); scanf("%f",&t); //Formula used p=((n*r*t)/(v-n*b))-((a*n*n)/(v*v)); printf("\n the calculated value of pressure is =%f atm",p); getch(); }
0 Comments