Quiz · Conditions · lesson 2 of 6
Quiz — which if owns the else
What does the program print?
#include <iostream>
int kind(int x) {
if (x > 0)
if (x > 10)
return 2;
else
return -1;
return 1;
}
int main() { std::cout << kind(5) << ' ' << kind(-5); }Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.