C Program to check if number is even or odd

program:-

#include<stdio.h>
main()
{
  int i;
  printf("Enter a Number\n");
  scanf("%d",&i);
  if(i%2==0)
  {
    printf("The number %d is Even",i);
  }
  else
  {
    printf("The number %d is Odd",i);
  }
  printf("\n");
}

output:-

Enter a Number
2
The number 2 is Even

Post a Comment

If you have any doubts, Please let me know
Thanks!

Previous Post Next Post