Guest User

Untitled

a guest
Jun 13th, 2012
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.02 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. float tc, tf;
  5. char op;
  6.  
  7. void Celsius_Fahrenheits() {
  8. printf("\nDigite a temperatura em Celsius.: ");
  9. scanf("%f", &tc);
  10. tf = ((9*tc + 160)/5);
  11. printf("\n temperatura em fahrenheits = %f\n", tf);
  12. }
  13.  
  14. void Fahrenheits_Celsius() {
  15. printf("\nDigite a temperatura em Fahrenheits.: ");
  16. scanf("%f", &tf);
  17. tc = ((5*(tf - 32))/9);
  18. printf("\nA temperatura em Celsius = %f\n", tc);
  19. }
  20.  
  21. main() {
  22. printf("\n1-Celsius -> Fahrenheits\n2-Fahrenheits -> Celsius.: ");
  23. scanf("%d", &op);
  24. switch (op) {
  25. case '1':
  26. Celsius_fahrenheint ();
  27. break;
  28. case '2' :
  29. fahrenheint_celsius ();
  30. break;
  31. default : ("opcao invalida\n");
  32. }
  33. return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment