#include <iostream> using namespace std; // Write your code here // Default: convert raw reading to Celsius float readTemp(int raw) { return raw / 10.0f; } // Overloaded: convert to Celsius or Fahrenheit float readTemp(int raw, char unit) { float celsius = raw / 10.0f; if (unit == 'F') { return celsius * 1.8f + 32.0f; } return celsius; // 'C' } int main() { int raw; char unit; cin >> raw >> unit; if (unit == 'D') { cout << readTemp(raw); } else { cout << readTemp(raw, unit); } return 0; }
Test Cases
Test Results
Input
250 D
Expected Output
25