Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jun 13th, 2012  |  syntax: None  |  size: 1.02 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  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.             }