If statement

If statement:

if statement is executed when the specified condition given is true.

Syntax:

if(condition)
{
s1;
s2;
}
s3;

Flow chart:

if

 

Example

#include<iostream.h>

void main()

 

{

int p;

cout<<“Enter a Number :”;

cin>>p;

if(p > 10)

{

cout<<p<<” > 10″;

}

}

Output

Enter a Number 500

500 >10.

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *