- Flowchart :
- Syntax :
goto label;
... .. ...
... .. ...
label:
statement;
- Program :
#include<conio.h>
void main()
{
int sum,i;
clrscr();
printf("\n----------------GOTO STATEMENT----------------");
printf("\nEnter the sum value :");
scanf("%d",&sum);
for(i=0;i<=10;i++)
{
sum=sum+i;
if(i==5)
{
goto addition;
}
}
addition:
printf("\nThe sum is : %d",sum);
getch();
}
- Output :
No comments:
Post a Comment