Tuesday, 5 September 2017

C-Program to print whether given number is Odd or Even

PROGRAM :  Given number is Odd or Even 

#include<stdio.h>

int main()
{
       int i;
      printf("Enter a Number to know whether it is even or odd\n");
scanf("%d",&i);
      if(i%2==0)    //To check given even or not
          printf("The number %d is Even",i);
     else
          printf("The number %d is Odd",i);
return 0;

}

Input : 5
Output : Odd

OUTPUT :




No comments:

Post a Comment