My Subject Blog

C Program Odd or Even

/*  Write a program to find out whether a number is odd / even by using different if..else statements.  */

#include <stdio.h>

int main(void) {
int n;
printf(" Enter any Number :");
scanf("%d",&n);
if(n%2==0)
{
printf("\n %d is Even",n);
}
else
{
printf("\n %d is Odd",n);
}

if(n&1==1)
{
printf("\n %d is Odd",n);
}
else
{
printf("\n %d is Even",n);
}
return 0;
}

Comments

Most Visited Post

C Program to Find Largest Odd Number from Array

Followers