C++ Programming Code Examples C++ > If Else and Switch Case Code Examples When there is an if statement inside another if statement then it is called the nested if statement. When there is an if statement inside another if statement then it is called the nested if statement. The structure of nested if looks like this: if(condition_1) { Statement1(s); if(condition_2) { Statement2(s); } } Statement1 would execute if the condition_1 is true. Statement2 would only execute if both the conditions( condition_1 and condition_2) are true. Example of Nested if statement #include <iostream> using namespace std; int main(){ int num=90; /* Nested if statement. An if statement * inside another if body */ if( num < 100 ){ cout<<"number is less than 100"<<endl; if(num > 50){ cout<<"number is greater than 50"; } } return 0; }