Saturday, 27 July 2019

How to write a program in c to check whether the given number is odd or even?

#include<stdio.h>
#include<conio.h>
void main()
{
   int num;
  clrscr();
  printf("Enter any number ");
  scanf("%d",&num);
   if(num%2==0)
      printf("%d is even.",num);
  else
       printf("%d is odd.",num);
    getch();
}

Output
  Enter any number: 5
     5 is odd.

No comments:

Post a Comment