moranguinho

exer6ES1

Mar 13th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. /*6) Escreva um algoritmo que converta um valor de temperatura de graus Celsius para
  2. graus Fahrenheit, cuja fórmula de conversão é: (9 * graus Celsius + 160) /5. Faça o teste
  3. de mesa para 5 valores verificando se o algoritmo está correto. Primeiro calcule ou
  4. procure o valor de saída esperado. Use a seguinte tabela para o teste de mesa. */
  5.  
  6. # include <stdio.h>
  7.  
  8. int main(void)
  9.  
  10. {
  11. //declarar variaveis
  12. float celsius, fahr;
  13.  
  14. //entrada
  15. printf("temperatura em graus Celsius: ");
  16. scanf("%f", &celsius);
  17.  
  18. //processamento
  19. fahr = (9 * celsius + 160) / 5;
  20.  
  21. //saida
  22. printf("%.2f graus Celsius correspondem a %.2f graus fahrenheit \n", celsius, fahr);
  23. }
Add Comment
Please, Sign In to add comment