Guest User

Untitled

a guest
Nov 20th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.47 KB | None | 0 0
  1. // Project temp.c - NAME; ID
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <dos.h>
  5. #include <math.h>
  6. #include <string.h>
  7.  
  8. int main()
  9. {
  10. float f, c, a1, a2;
  11. int choice;
  12. printf("Project temp.c - NAME; ID");
  13.  
  14. printf("nnProgram to convert degrees in Fahrenheit to Celsius");
  15. printf("nn1) Fahrenheit to Celcius");
  16. printf("n2) Celcius to Fahrenheit");
  17. printf("n3) Just want to exit the program");
  18.  
  19. printf("nnEnter your choice 1, 2, or 3: ");
  20. scanf("%d", &choice);
  21.  
  22. if(choice == 1)
  23. {
  24. printf("nEnter the degrees in Fahrenheit: ");
  25. scanf("%f", &f);
  26. a1= (f-32)*5/9; /*conversion for Fahrenheit to Celcius*/
  27. printf("n**************************");
  28. printf("nOriginal Temperature in Fahrenheit: %0.2f", f);
  29. printf("nTemperature converted to Celcius: %0.2f", a1);
  30. printf("n**************************");
  31.  
  32. }
  33.  
  34. else if(choice == 2)
  35. {
  36. printf("nEnter the degrees in Celcius: ");
  37. scanf("%f", &c);
  38. a2= c*1.8+32; /*conversion for Celcius to Fahrenheit*/
  39. printf("n**************************");
  40. printf("nOriginal Temperature in Celcius: %0.2f", c);
  41. printf("nTemperature Converted to Fahrenheit: %0.2f", a2);
  42. printf("n**************************");
  43. }
  44.  
  45. else if(choice == 3)
  46. {
  47. printf("nnPress Enter to exit ...n");
  48. getche();
  49. return 0;
  50. }
  51. printf("nnPress Enter to exit ...n");
  52. getche();
  53. return 0;
  54. }
Add Comment
Please, Sign In to add comment