Skip to main content

Given number is even or odd

#include <stdio.h>
int main()
{
  int n;
  printf("Enter a number\t:\t");
  scanf("%d", &n);
  if(n % 2 == 0)
    printf("\n%d is an even number", n);
  else
    printf("\n%d is a odd number", n);

  return 0;
}

Enter a number :  5

5 is a odd number

Comments