C Programming Tutorial
Computer Tutorial

Multiple if Statements



Multiple if Statements

Multiple if statement is used when more than one condition need to be execute. It may so happen that in a program we want more than one statement to be executed if the expression following if is satisfied.

The general form of Multiple if statement is :

if ( condition / expression  )
{
Statements to be executed ;
.
.
}
if ( condition / expression  )
Statements to be executed ;
.
.
if ( condition / expression  )
Statements to be executed ;

C Program to show the use of Multiple if statement

\* C Program to show the use of Multiple if statement *\
# include < stdio.h >
int   main( )
{

int   num  ;
printf(" Enter any number : ") ;
scanf("%d ", & num) ;
if ( num < 0  )
{

printf("\n Entered number is a negative number. ") ;

}
if ( num == 0  )

printf("\n Entered number is zero. ") ;

if ( num > 0  )

printf("\n Entered number is positive number. ") ;

return ( 0 );

}