Simple if:
The general form of a simple if statement is:
if ( test expression )
{
Statement
– block;
}
Statement
x;
The
‘statement – block’ may be a single statement or a group of statements. If the
test expression is true, the statement – block will be executed; otherwise the
statement block will be skipped and the execution will be jumped to statement –
x.
Remember,
when the condition is true both the statement – block and the statement – x are
executed in sequence. The flowchart is:
For Example:
if( a > 10 ) /* if ( test expression ) */
{
printf(
“\n Number is greater than 10”); /* Statement – block */
}
printf (“\n Bye”); /* statement – x */
Post a Comment