/* */ Click to Join Live Class with Shankar sir Call 9798158723

If Statement in C++


If statement will executed in the code and check only if the condition is true.

Syntex :-

if"(condition)"
"{"
// you can enter a code here.
"}"

the statement is executed when the condition is true.

Q.) W.A.P to check number is even or not ?
#include < iostream>  
using namespace std;  
   
int main () {  
   int num = 18;    
            if (num % 2 == 0)    
            {    
                cout<<"It is even number";    
            }   
   return 0;  
}  
Output
It is even number