Saturday 8 December 2012

goto statement in c program | simple goto example in c


In this article we are going to learn how to work with goto statement in c programming language.
Basically goto is jump statement which means we can go one point or functionality to another functionality  in same function or within function. for  that we use goto statement.

#include<stdio.h> // including header files
#include<conio.h>
void main()
{
int n;
clrscr();
printf("Enter the no");
scanf("%d",&n);
if(n % 2==0)
goto even;  // will goto even
else
goto odd;
even:printf("even"); // will print if number is even
odd:printf("odd");
getch();
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: