← Back to archive

Stdle #111 · numbers · 2026-09-25

What does this C++ snippet output?

A past puzzle — fully playable. 4 attempts, hints on wrong guesses.

#include <iostream>
int main() {
int x = 4;
int r = (x > 0) ? (x > 3 ? 9 : 8) : 7;
std::cout << r << "\n";
}
Numbers
4 attempts left

Answer & explanation