Write a Program that accepts a no & find if odd or even

#include<stdio.h>
#include<conio.h>
void main()
{
  int no;
  clrscr();
  printf("Enter a number");
  scanf("%d",&no);
  if(no%2==0)
  {
    printf("Even number");
  }
  else
  {
    printf("Odd number");
  }
  getch();
}

2 comments:

  1. hi,, it is also good but i just find a little different...... write a C++ program to accept a four digit number and print whether it it an odd or even number??
    .
    .
    can you help me to solve this...?

    ReplyDelete
  2. In my blog I am trying to describe all the codes in an innovative way. You guys can have a look.
    http://cprogramminglibrary.blogspot.com/2018/04/even-or-odd.html

    ReplyDelete

Related Post

Array:
String functions:
General (Loops-for/while)
Write a Program to print reverse of a given number Write a Program to print Product of Digits (eg. 212=2*1*2=4) of a given number Write a C++ Program to Convert Binary into Decimal Number