Share this post on:

Jumping Statement in C is used to jumps the control from one location to another location in the program.

There are three types of Jumping Statement :

  1. break
  2. continue
  3. goto

  • Break : This statement is used to terminate the switch or loop forecly.

Example:

for(i=1;i<=100;i++)

if(i>=50)

break;

else

printf(“%d”,i)

Example :

for(i=1;i<=100;i++)

if(i>=50) && (i<=75)

break;

else

printf(“%d”,i);

Continue : It is reverse of break . It shifts the control in the loop forcely.

Example:

for(i=1;i<=100;i++)

if(i>=50)

continue;

else

printf(“%d”,i);

Example :

for(i=1;i<=100;i++)

if(i>=50) && (i<=75)

continue;

else

printf(“%d”,i);

goto : This statement is used to jump the control from one level to another level in the program.

Genral Format:

goto label;

label;

Where label is any valid identifier.

Example : Write a Program to demonstrate goto statement?

#include<stdio.h>

void main()
{
int a,b;
printf(“Enter two no:”);
scanf(“%d%d”,&a&b);
if(a>b)
goto first;
else
goto second;
first;
printf(“%d”,a);
second;
printf(“%d”,b);
last;
}

Share this post on:
Avatar Raiyan

Author: Raiyan

Hi, I guess you're here because you want to know a bit about me. huh? I am not so good on talking about myself but I'll give a short about me.

My Name is Raiyan. I am a Professional Application Developer and a Blogger.
I started this website to Share my Knowledge. Here I provide all my knowledge whatever I earned till now.

Leave a Comment

Your email address will not be published. Required fields are marked *