The If statement by itself will execute a single statement, or a group of statements, when the test expression is true. It does nothing when it is false. We can execute a group of statements if and only if the test expression is not true. Its Syntax is:
if( condition)
statement;
else
statement;
Lets have a look at the following example:
Program
void main ( )
{
char ch;
ch= getche( );
if (ch = = 'y' )
printf(" You entered y");
else
printf(" You did not entered y");
}
Output
y
You entered y
n
You did not entered y
No comments:
Post a Comment