programplug Logo




C++ If,else,elseif Statement


The if statement perform operation either condition is true or false.


  • If statement
  • If-else statement
  • else-if statement
  • Nested if

If Statement

This statement execute the code if condition is true


if(condition)
{  
Statements Condition True  
}  
 
#include
void main()
{
	int a=20,b=10;
	if(a>b)
	{
	cout<<"Greater Is"a;
	}
}

output:- 20


If-else statement

if-else statement execute the code if condition is true or false.


if(condition)
{  
Statement Condition True  
}
else{  
Statement Condition False  
}   
 
#include
void main()
{
	int n=2;
	if(n>0)
	{
	cout<<"Number Is Positive";
	}
	else{
	cout<<"Number Is Negative";
	}
}

output:- Number Is Positive


else-if statement

else-if statement is used to execute one code multiple conditions


if(condition)
{  
Statement Condition True 
}
else if(condition){  
Statement Condition True 
}  
else if(condition){  
Statement Condition True  
}  
 
else{  
Statement Condition False
}    






Our Services

Developing Cheapest Websites
Offer Digital Marketing
Provide College Projects
Attractive Website Developing
Summer Training,Industrial Training
SCO,SMO

Contact Us

Dehradun Uttarakhand India
www.programplug.com
info@programplug.com
000000000

Other Link

About Us

Contact Us

Disclaimer

Privacy Policy