C++ Simple if Statement

C++ Simple if Statement ?

This statement is used for testing a condition and excuting a part of code based on the result of the condition.
The condition shuld be a boolean expression which evaluates to either true or false.

if(expression or condition)

The condition or test expression is evaluated.

If the result of the expression is true a bloack of statements will be executed.

If the result is false the program continues from the next statement after the if block.

Syntax :

if (condition)
  {   .......
If Statement in C

Example 1:

Output :

  ---aimtocode.com Student Details:--- 
Enter your percentage: 71
You scored 71%
Congratulation: You have passed

Enter your percentage: 34
You scored 34%

Example 2:

Output :

Variable x is less than y