
Untitled
By: a guest on
Jun 13th, 2012 | syntax:
None | size: 1.02 KB | hits: 17 | expires: Never
#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;
}