if-else

 

If Statement :- 

The if statement tests a particular condition. When the condition is evaluates true, then the

statement  is executed otherwise else statement executed.

 

Syntax :-

If(Expression ){

Statement;

}

else{

Statement;}

#include<iostream.h>

#include<conio.h>

 

Void main()
{

Int a,b;
Cout<<”Enter the value of a “<<endl;
Cin>>a;
Cout<<”Enter the value of b”<<endl;
Cin>>b;
If(a>b)
{
Cout<<”The value of a is grater “<<endl;

}
Else
{
Cout<<”The value of b is grater “<<endl;
}
Getch();
}

  Examples Based on If-else Leader.




Follow Us

Contact Us

tutorialworldin@yahoo.com

Back to Top