×
☰ Menu

else if ladder (else if Clause)

Suppose we need to specify multiple conditions then we need to use multiple if statements or else if ladder.

 

Sample Program on else if ladder

void main( )
{
int per;
printf("enter per:\n");
scanf("%d",&per);
if ( per >= 60 )
printf ( "First division" ) ;
else if ( per >= 50 )
printf ( "Second division" ) ;
else if ( per >= 40 )
printf ( "Third division" ) ;
else
printf ( "fail" ) ;
getch();
}