If Statement in C++ | Topic 8 | VU Insider



In our daily life, we often make decisions like "If store is open, bring some groceries" or "If a student got more then 60% marks in intermediate then he/she can get admission".

In this structure, an element of decision making is present. The statement will be executed when the condition is true. One will bring groceries if and only if when the store is open.

C language provides this type of decision structure known as "If statement".

Syntax for IF Statement:
If (condition)
Statement or group of statementscode-box


Example for IF Statement:
In easy English;
If (store is open)
Bring some groceries
code-box


In C++;
In C language;
If (age1>age2)
cout<<"Ali is older than Asif"; code-box

Post a Comment

Previous Post Next Post