Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <math.h>
- float tc, tf;
- char op;
- void Celsius_Fahrenheits() {
- printf("\nDigite a temperatura em Celsius.: ");
- scanf("%f", &tc);
- tf = ((9*tc + 160)/5);
- printf("\n temperatura em fahrenheits = %f\n", tf);
- }
- void Fahrenheits_Celsius() {
- printf("\nDigite a temperatura em Fahrenheits.: ");
- scanf("%f", &tf);
- tc = ((5*(tf - 32))/9);
- printf("\nA temperatura em Celsius = %f\n", tc);
- }
- main() {
- printf("\n1-Celsius -> Fahrenheits\n2-Fahrenheits -> Celsius.: ");
- scanf("%d", &op);
- switch (op) {
- case '1':
- Celsius_fahrenheint ();
- break;
- case '2' :
- fahrenheint_celsius ();
- break;
- default : ("opcao invalida\n");
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment