View Code of Problem 69

#include <iostream>

int myFunc(int x) {
    if (x < 1) {
        return x;
    } else if (x < 10) {
        return 2 * x - 1;
    } else {
        return 3 * x - 11;
    }
}

int main() {
    int x;
    while (std::cin >> x) {
        std::cout << myFunc(x) << '\n';
    }
}

Double click to view unformatted code.


Back to problem 69