C++ if statement

An if statement contains a Boolean expression and block of statements enclosed within. Among the decision making statements, it is the most simple one. It checks if the condition is true or not, and if it is true then it executes the block of code inside if otherwise, it will not. Block that is executed is placed within the curly braces({}).

Syntax of if statement:

Example of if statement

The condition (x<y) in the “if” returns true for the value of x and y, so the statement inside the body of if is executed.
The following result is:-

Question-related to C++ programming