Advertisement
LightProgrammer000

Conversor de Temperatura [ Fah -> Cel ]

Nov 21st, 2018
244
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.61 KB | None | 0 0
  1. // Biblioteca
  2. #include <stdio.h>
  3.  
  4. // Funcao: Retorno de Valor Float
  5. float convert( float f );
  6.  
  7. // Funcao Principal
  8. int main()
  9. {
  10.     // Variaveis
  11.     float temp_f;
  12.     float temp_c;
  13.  
  14.     // Entrada de Dados
  15.     printf("\n Temperature in Fahreinheit: ");
  16.     scanf("%f", &temp_f );
  17.  
  18.     // Chamada de Funcao e Atribuicao em Variavel
  19.     temp_c = convert( temp_f );
  20.  
  21.     // Mensagem
  22.     printf("\n %.1fF is %.1fC \n", temp_f, temp_c );
  23.  
  24.     return(0);
  25. }
  26.  
  27. // Funcao:
  28. float convert( float f )
  29. {
  30.     // Variavel
  31.     float t;
  32.  
  33.     // Calculo
  34.     t = ( ( f - 32 ) / 1.8 ) ;// f = temp_f
  35.  
  36.     return(t);
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement