Advertisement
snaptrap013

Untitled

Mar 20th, 2020
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.27 KB | None | 0 0
  1. #include <stdio.h>
  2. int value(int);
  3. #define a 3.592
  4. #define b 0.0427
  5. #define R 0.08206
  6. int n;
  7. int T;
  8. int v;
  9. float p;
  10. void realgas (float n, float T);
  11. void display1 (float V);
  12. void display2 (float P);
  13. void error ();
  14. int main()
  15. {
  16. float n,T,ini_vol,fin_vol;
  17.  
  18. do {
  19. printf("Mole : ");
  20. scanf("%f",&n);
  21. } while( n <= 0);
  22.  
  23. printf("\n");
  24.  
  25. do {
  26. printf("Temperature (Kelvin): ");
  27. scanf("%f",&T);
  28. }while(T<=0);
  29. printf("\n");
  30.  
  31. do {
  32. printf("Initial Volume (milliliter): ");
  33. scanf("%f",&ini_vol);
  34. }while(ini_vol<=0);
  35. printf("\n");
  36.  
  37. do{
  38. printf("Final Volume(): ");
  39. scanf("%f",&fin_vol);
  40. }while(fin_vol<=0);
  41. printf("\n");
  42.  
  43. {
  44. printf("Increment: ");
  45. scanf("%d");
  46. }
  47.  
  48. {
  49. printf("\n%0.4f moles of carbon dioxide at %.0f Kelvin\n",n,T);
  50. }
  51.  
  52. {
  53. printf("\nVolume (milliliter)\tPressure(atm)");
  54. }
  55.  
  56. {
  57. int i;
  58. float p; //= 0;
  59. int volume;
  60. for(i = 400; i <=600 ; i += 50){
  61. volume = i/1000;
  62. p = ((n * R * T) / (volume - (n * b))) - (((n*n) * a) / (volume*volume));
  63. printf("\n%d\t\t\t%f\n", i, p);
  64. }
  65. {
  66. printf("\n\nDo you want to continue (Y-Yes,N-No):Y\n");
  67. }
  68. {
  69. printf("-----------------------------------------------------\n");
  70. }
  71. do {
  72. printf("Mole : ");
  73. scanf("%f",&n);
  74. } while( n <= 0);
  75.  
  76. printf("\n");
  77.  
  78. do {
  79. printf("Temperature (Kelvin): ");
  80. scanf("%f",&T);
  81. }while(T<=0);
  82. printf("\n");
  83.  
  84. do {
  85. printf("Initial Volume (milliliter): ");
  86. scanf("%f",&ini_vol);
  87. }while(ini_vol<=0);
  88. printf("\n");
  89.  
  90. do{
  91. printf("Final Volume(): ");
  92. scanf("%f",&fin_vol);
  93. }while(fin_vol<=0);
  94. printf("\n");
  95.  
  96. {
  97. printf("Decrement: ");
  98. scanf("%d");
  99. }
  100.  
  101. {
  102. printf("\n%0.4f moles of carbon dioxide at %.0f Kelvin\n",n,T);
  103. }
  104.  
  105. {
  106. printf("\nVolume (milliliter)\tPressure(atm)");
  107. }
  108.  
  109. {
  110. for(i = 600; i >= 400; i -= 50){
  111. volume = i/1000;
  112. p = ((n * R * T) / (volume - (n * b))) - (((n*n) * a) / (volume*volume));
  113. printf("\n%d\t\t\t%f\n", i, p);
  114. }
  115. {
  116. printf("\n\nDo you want to continue (Y-Yes,N-No):N\n");
  117. }
  118. {
  119. printf("-----------------------------------------------------\n");
  120. }
  121. {
  122. printf("From this calculation, you know that when volume (ml) in increasing,\npressure of gas reduce\n\nThank you. ");
  123. }
  124. }
  125.  
  126. return 0;}
  127.  
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement