In this program, the user is ask for integer number, if he/she enters 0 (ZERO) then it will again ask for the number until he enters a valid number. Here we have used goto statement. A goto statement in C programming provides an unconditional jump from the 'goto' to a labeled statement in the same function. Any program that uses a goto can be rewritten to avoid them. Syntax: goto label; Example: goto start;
#include <stdio.h>
int main ()
{
int no;
accept:
printf ("Enter any Number: ");
scanf ("%d", &no);
if (no == 0)
goto accept;
printf("You have entered %d", no);
return 0;
}
Enter any Number: 0
Enter any Number: 0
Enter any Number: 12
You have entered 12