Constexpr ADC Temperature Table

#include <iostream>
using namespace std;

constexpr int TEMP_TABLE[6] = {-40, -10, 20, 50, 80, 120};

int main() {
    int idx;
    cin >> idx;
    cout << TEMP_TABLE[idx];
    return 0;
}

Solving Approach

 

 

 

 

 

 

Upvote
Downvote
Loading...

Input

0

Expected Output

-40