Submit | All submissions | Best solutions | Back to list |
ORTL1P06 - Fahrenheit |
Write a program that converts temperature to Celsius if it's given in Fahrenheit (input will have an 'F' after the number), or vice versa, if it's given in Celsius (input will have a 'C' after the number).
At least two decimal places must be exact. Other decimals are ignored.
If C is the temperature in Celsius, the conversion formula to Fahrenheit is: F = 32 + 9*C/5.0
If F is the temperature in Fahrenheit, the conversion formula to Celsius is: C = 5*(F-32)/9.0
Input
One line with an integer number (between -200 and 100), a space, and a letter ('C' or 'F')
Output
The temperature converted, in the same format as the input (a number, a space, and a letter 'C' or 'F' indicating if it was converted to Celsius or Fahrenheit, respectively.
Example
Input: 22 C Output: 71.60 F
Added by: | Joaquin |
Date: | 2014-05-26 |
Time limit: | 1s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2015-09-27 07:55:26
on submission i got "50" written on result column with row printed in black ..... but the code is not accepted ...?????? please help...... someone... admin spoj |