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:-
0 Comments