adsense

Hii, welcome to my site. My name is Om prakash kartik. This blog helps you to learn programming languages concepts.

program in c to check a number is odd or even using function and enumeration

program in c to check a number is odd or even using function with enumeration


#include<stdio.h>
#include<conio.h>
 enum boolean
       {
           true,false
       }r;
 enum boolean isEven(int a);
 void main()
   {
     int x;
     enum boolean r;
     printf("Enter a number:-");
     scanf("%d",&x);
     r=isEven(x);
     if(r==true)
        printf("Even no.");
     else
        printf("Odd no.");
     getch();
     return 0;
    }
   enum boolean isEven(int a)
    {
       if(a%2==0)
        return (true);
       else
        return (false);
   }
Output:-





Post a Comment

0 Comments