NextIndexPrevious

Programs in C language

3. Program to find whether the given number is Even or Odd.
#include<stdio.h>

void main()
{
    int n;
    clrscr();
    printf("Enter a number:");
    scanf("%d",&n);
    
    if(n%2 == 0)
    	printf("Even number");
    else
    	printf("Odd number");
    
    getch();
}
Input :

284
Output :

Even number



Father of C Language
Dennis Ritchie

Dennis Ritchie

Born: September 9, 1941, Bronxville
Died: October 9, 2011, Murray Hill
Google+