Use of if else (heaven/hell)
#include<stdio.h>
#include<conio.h>
void main( )
{
int i ;
printf ( "Enter either 1 or 2 :" ) ;
scanf ( "%d", &i ) ;
if ( i == 1 )
printf ( "You would go to heaven !\n" ) ;
else
{
if ( i ==2 )
printf ( "Hell was created with you in mind\n" ) ;
else
printf ( "How about mother earth !\n" ) ;
}
getch() ;
}
Output 1 :
Enter either 1 or 2 : 1
You would go to heaven !
[Process completed (code 10) - press Enter]
Output 2 :
Enter either 1 or 2 : 2
Hell was created with you in mind
[Process completed (code 10) - press Enter]
Output 3 :
Enter either 1 or 2 : 7
How about mother earth !
[Process completed (code 10) - press Enter]
Comments
Post a Comment