Course Content
Detailed Content of Programming in C
0/1
Introduction
0/1
Structure of C program
0/1
Answers of ‘C’ Pointers Programs
0/1
About Lesson

Using Goto to Jump to a Specific Label:

#include <stdio.h>

int main() {
int num;

// Taking input for the number
printf(“Enter a positive integer: “);
scanf(“%d”, &num);

// Using goto to jump to a specific label if the number is negative
if (num < 0) {
goto negative;
}

printf(“The entered number is positive.n”);
return 0;

// Label for negative numbers
negative:
printf(“The entered number is negative.n”);

return 0;
}