[코테 풀이] Convert the Temperature

시내·2024년 6월 10일
0

Q_2469) Convert the Temperature

출처 : https://leetcode.com/problems/convert-the-temperature/

You are given a non-negative floating point number rounded to two decimal places celsius, that denotes the temperature in Celsius.

You should convert Celsius into Kelvin and Fahrenheit and return it as an array ans = [kelvin, fahrenheit].

Return the array ans. Answers within 10-5 of the actual answer will be accepted.

Note that:

Kelvin = Celsius + 273.15
Fahrenheit = Celsius * 1.80 + 32.00

class Solution {
    public double[] convertTemperature(double celsius) {
     return new double[] {celsius + 273.15, celsius * 1.80 + 32.00};
    }
}
profile
contact 📨 ksw08215@gmail.com

0개의 댓글