Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.03 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main ()
  5. {
  6.  
  7. int cases;
  8. float a;
  9. float c;
  10.  
  11. printf("\n CONVERSION \n");
  12. printf("\n \n FEET to INCHES = 1 \n INCHES to FEET = 2\n INCHES to CM = 3\n CM to INCHES =4\n CELSIUS to FAHRENHEIT =5\n FAHRENHEIT to CELSIUS =6\n");
  13. scanf("%d", &cases);
  14. printf("\n INPUT NUMBER: ");
  15. scanf("%f", &a);
  16.  
  17. if (cases==1)//feet to inches
  18. {
  19. c = a * 12;
  20.  
  21. printf(" %.2f feet = %.2f inches", a,c);
  22. }
  23. else if(cases==2)//inches to feet
  24. {
  25.  
  26. c = a * 0.83333;
  27. printf(" %.2f inches = %.2f feet", a,c);
  28. }
  29. else if(cases==3)//feet to centimeters
  30. {
  31. c = a / 0.39370;
  32. printf(" %.2f feet = %.2f centimeters", a,c);
  33. }
  34. else if (cases==4)//centimeters to inches
  35. {
  36. c = a * 0.39370;
  37. printf(" %.2f centimeters = %.2f inches", a,c);
  38. }
  39. else if (cases==5)//celsius to fahrenheit
  40. {
  41. c = a * 1.8000 + 32.00;
  42. printf(" %.2f celsius = %.2f fahrenheit", a,c);
  43. }
  44. else if (cases==6)// fahrenheit to celsius
  45. {
  46. c = a - 32 / 1.8000;
  47. printf(" %.2f fahrenheit = %.2f celsius", a,c);
  48. }
  49. else
  50. {
  51. printf(" I N V A L I D ");
  52. }
  53. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement