Skip to main content

IF GOTO STATEMENT


Write a program to print counting from one to ten using if go to statement.
Today we are simply going to discuss about the use of if go to statement. If go to statement is used to transfer the control of execution to the specify label.

Syntax: -
goto    label name;

Program: -

#include<stdio.h>
#include<conio.h>
void main()
{
int a=1;
clrscr();
x:if(a<=10)
{
printf("\n %d",a);
a++;
goto x;
}
getch();
}

Output: -

1
2
3
4
5
6
7
8
9
10



Comments