Given a number n, the task is to check whether the given n is even or odd using Lex program.
Input : 10 Output : Even Input : 5 Output : Odd
Prerequisite: FLEX (Fast Lexical Analyzer Generator)
An even number is an integer which is “evenly divisible” by 2. This means that if the integer is divided by 2, it yields no remainder or 0 as remainder. Similarly, an Odd number is an integer which is not “evenly divisible” by 2 and will leaves 1 as remainder.
Below is the implementation of above approach:
- Lex program to check whether given number is armstrong number or not
- Lex program to check whether input number is odd or even
- Lex Program to check whether a number is Prime or Not
- Lex program to check valid Mobile Number
- Lex program to check whether given string is Palindrome or Not
- Lex Program to check valid email
- Lex program to check if a Date is valid or not
- Lex program to check whether the input is digit or not
- Lex program to check perfect numbers
- YACC program to check whether given string is Palindrome or not
- Compiler Design | C program to check syntax of 'for' loop
- Lex Program to count number of words
- Lex program to check whether an year is a leap year or not
- LEX program to count the number of vowels and consonants in a given string
- Lex program to count the number of lines, spaces and tabs
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.