C Programming

C Program – Given number is Even or Odd

C Program to find given number is Even or Odd.

Even or Odd :

EvenOrOdd.c
#include<stdio.h> 
int main(void) 
{ 
    int n; 
    printf("Enter any number : "); 
    scanf("%d",&n); 
    if(n%2==0)             
        goto even_number; 
    else 
        goto odd_number; 
    even_number: 
        printf("Given number is even\n");  
        goto end; 
    odd_number: 
        printf("Given number is odd\n"); 
        goto end; 
    end: 
    printf("\n"); 
    return 0; 
}

Output:

Terminal
Enter any number : 10
Given number is even

Enter any number : 7
Given number is odd

Happy Learning :)

Found a mistake or something out of date? Tell us →

Written by

chandrashekhar

Founder of onlinetutorialspoint.com. Enterprise architect with 15+ years in healthcare technology, designing and running systems on AWS and Azure. Writes about building real things with AI, local AI hardware and cloud certifications.

Keep reading

Ask a question or leave a comment