Programming Examples

Write a program entered number check the number is even or odd by using goto statement.

 Write a program to detect the entered number as to whether it is even or odd. Use the goto statement.


# include <stdio.h>
int main()
int x;
printf(" Enter a Number :");
goto even;
goto odd;
even :
printf("\n %d is Even Number.",x);
printf("\n %d is Odd Number.",x);
return 0;


Enter a Number : 5

5 is Odd Number.


 In the above program, a number is entered. The number is checked for even or odd with modules division operator. When the number is even, the goto statement transfers the control to the label even. Similarly, when the number is odd the goto statement transfers the control to the label odd and respective message will be displayed.

Latest Current Affairs 2024 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test 2024 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz