Wednesday, 19 March 2014

C Program for A quick demo of nested if-else

/* A quick demo of nested if-else */
main( )
{
int   i ;
printf ( "Enter either 1 or 2 " ) ;
scanf ( "%d", &i ) ;
if ( i == 1 )
printf ( "You would go to heaven !" ) ;
else
{
if ( i == 2 )
printf ( "Hell was created with you in mind" ) ;
else
printf ( "How about mother earth !" ) ;
}
}

No comments:

Post a Comment