Problem: Write a Lex program to check whether an year is a leap year or not.
Lex is a computer program that generates lexical analyzers and was written by Mike Lesk and Eric Schmidt. Lex reads an input stream specifying the lexical analyzer and outputs source code implementing the lexer in the C programming language.
Note: Leap years are the years that are divisible by 400 or are divisible by 4 and not divisible by 100. So 2016, 2020 etc are leap years while 2017 and 2019 are not.
Input: 2016 Output: leap year Input: 2017 Output: not a leap year
- Lex program to check whether a given number is even or odd
- Lex program to check if a Date is valid or not
- Lex program to check whether given string is Palindrome or Not
- Lex program to check whether input number is odd or even
- Lex program to check perfect numbers
- Lex Program to check whether a number is Prime or Not
- Lex program to check whether the input is digit or not
- Lex Program to check valid email
- C program to check syntax of 'for' loop
- YACC program to check whether given string is Palindrome or not
- Lex program to check valid Mobile Number
- Lex program to check whether given number is armstrong number or not
- C program to detect tokens in a C program
- Lex Program to remove comments from C program
- Lex program to identify the identifier
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.