C program to find even or odd using goto

#include<stdio.h>

int main()
{
    int n;
    printf("enter the number\n");
    scanf("%d",&n);
    if(n%2==0)
        goto even;
    else
        goto odd;
    even: printf("even number\n");
           return;
           odd: printf("odd number\n");
           return;
}

output:
enter the number
7
odd number

No comments:

Post a Comment