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();
0 comments: