Leetcode / 2469. Convert the Temperature
Pick a programming language:
Here is the source code for the solution to this problem.
class Solution {
public double[] convertTemperature(double celsius) {
double[] ans = new double[2];
ans[0] = celsius + 273.15;
ans[1] = 1.8 * celsius + 32.0;
return ans;
}
}
class Solution {
public:
vector<double> convertTemperature(double celsius) {
return { celsius + 273.15, celsius * 1.8 + 32 };
}
};
public class Solution {
public double[] ConvertTemperature(double celsius) {
return new double[] { celsius + 273.15, celsius * 1.8 + 32 };
}
}
Did you like the lesson? 😆👍
Consider a donation to support our work: