< Prev
Next >



Nested if Statement





In C++, the nested-if is another decision making statement in which an if statement is nested inside an outer if statement, hence it is named nested if.

The statement connected to the nested if statement is only executed when -:





nested if example


/* C++ nested if statement*/

#include<iostream>

using namespace std;
int main()
{
if(99<100)
{
	if(99>98)  // This is a nested if  statement
	cout<<"99 is less than 100 & 99 is greater than 98";
}

else 
	cout<<"99 is not less than 100";
	
return 0;
}


Output


99 is less than 100 & 99 is greater than 98




Please share this article -

Facebook Google Pinterest Reddit Tumblr Twitter




< Prev
Next >
< Else-If Statement
Nested If-Else Statement>
Please subscribe our social media channels for notifications, we post a new article everyday.

Decodejava Google+ Page Decodejava Facebook Page  DecodeJava Twitter Page

Coming Next
-
Python

Ad2