Check whether number is positive, negative, even or odd

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
clrscr();
printf("enter the no");
scanf("%d",&n);
if(n>0)
{
printf("\nnumber is +ve");
if(n%2==0)
printf("\n number is even");
else
printf("\n number is odd");
}
if(n<0)
printf("\n number is -ve");
getch();
}

6 comments:

  1. Appreciation for nice Updates, I found something new and folks can get useful info about BEST ONLINE TRAINING

    ReplyDelete
  2. C program to check odd or even

    In general Even numbers are those which are divisible by 2, and which numbers are not divisible 2 is called odd numbers.
    We can easily write even odd program in c programming.

    ReplyDelete