fork download
  1. #include <stdio.h>
  2. double cTof(double t){
  3. return t*9/5+32;}
  4. double fToc(double q){
  5. return (q-32)*5/9;}
  6. int main(void) {
  7. // your code goes here
  8. double a,Tc;
  9. char unit;
  10. scanf("%lf %c", &a,&unit);
  11. if (unit=='c'||unit=='C'){
  12. Tc=cTof(a);
  13. printf("%lf C is %lf F",a,Tc);
  14. }else{
  15. Tc=fToc(a);
  16.  
  17. printf("%lf F is %lf C",a,Tc);
  18. }
  19.  
  20. return 0;
  21. }
  22.  
Success #stdin #stdout 0s 5296KB
stdin
74f
stdout
74.000000 F is 23.333333 C