home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C Programming Starter Kit 2.0
/
SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso
/
tyc
/
list13_3.c
< prev
next >
Wrap
C/C++ Source or Header
|
1993-10-16
|
579b
|
36 lines
/* Demonstrates the goto statement */
#include <stdio.h>
main()
{
int n;
start: ;
puts("Enter a number between 0 and 10: ");
scanf("%d", &n);
if ( n < 0 || n > 10 )
goto start;
else if (n == 0)
goto location0;
else if (n == 1)
goto location1;
else
goto location2;
location0: ;
puts("You entered 0.");
goto end;
location1: ;
puts("You entered 1.");
goto end;
location2: ;
puts("You entered something between 2 and 10.");
end: ;
}