Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int value(int);
- #define a 3.592
- #define b 0.0427
- #define R 0.08206
- int n;
- int T;
- int v;
- float p;
- void realgas (float n, float T);
- void display1 (float V);
- void display2 (float P);
- void error ();
- int main()
- {
- float n,T,ini_vol,fin_vol;
- do {
- printf("Mole : ");
- scanf("%f",&n);
- } while( n <= 0);
- printf("\n");
- do {
- printf("Temperature (Kelvin): ");
- scanf("%f",&T);
- }while(T<=0);
- printf("\n");
- do {
- printf("Initial Volume (milliliter): ");
- scanf("%f",&ini_vol);
- }while(ini_vol<=0);
- printf("\n");
- do{
- printf("Final Volume(): ");
- scanf("%f",&fin_vol);
- }while(fin_vol<=0);
- printf("\n");
- {
- printf("Increment: ");
- scanf("%d");
- }
- {
- printf("\n%0.4f moles of carbon dioxide at %.0f Kelvin\n",n,T);
- }
- {
- printf("\nVolume (milliliter)\tPressure(atm)");
- }
- {
- int i;
- float p; //= 0;
- int volume;
- for(i = 400; i <=600 ; i += 50){
- volume = i/1000;
- p = ((n * R * T) / (volume - (n * b))) - (((n*n) * a) / (volume*volume));
- printf("\n%d\t\t\t%f\n", i, p);
- }
- {
- printf("\n\nDo you want to continue (Y-Yes,N-No):Y\n");
- }
- {
- printf("-----------------------------------------------------\n");
- }
- do {
- printf("Mole : ");
- scanf("%f",&n);
- } while( n <= 0);
- printf("\n");
- do {
- printf("Temperature (Kelvin): ");
- scanf("%f",&T);
- }while(T<=0);
- printf("\n");
- do {
- printf("Initial Volume (milliliter): ");
- scanf("%f",&ini_vol);
- }while(ini_vol<=0);
- printf("\n");
- do{
- printf("Final Volume(): ");
- scanf("%f",&fin_vol);
- }while(fin_vol<=0);
- printf("\n");
- {
- printf("Decrement: ");
- scanf("%d");
- }
- {
- printf("\n%0.4f moles of carbon dioxide at %.0f Kelvin\n",n,T);
- }
- {
- printf("\nVolume (milliliter)\tPressure(atm)");
- }
- {
- for(i = 600; i >= 400; i -= 50){
- volume = i/1000;
- p = ((n * R * T) / (volume - (n * b))) - (((n*n) * a) / (volume*volume));
- printf("\n%d\t\t\t%f\n", i, p);
- }
- {
- printf("\n\nDo you want to continue (Y-Yes,N-No):N\n");
- }
- {
- printf("-----------------------------------------------------\n");
- }
- {
- printf("From this calculation, you know that when volume (ml) in increasing,\npressure of gas reduce\n\nThank you. ");
- }
- }
- return 0;}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement