Problem: Write a Lex Program to check whether a number is Prime 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.
Definition: A prime number is a whole number greater than 1 whose only factors are 1 and itself. A factor is a whole numbers that can be divided evenly into another number. The first few prime numbers are: 2, 3, 5, 7, 11, 13, 17, 19, 23 and 29.
Input: 2 Output: Prime number Input: 6 Output: Not a Prime number
- Lex program to check whether given number is armstrong number or not
- Lex program to check whether a given number is even or odd
- Lex program to check whether input number is odd or even
- Lex program to check valid Mobile Number
- Lex Program to check valid email
- Lex program to check whether the input is digit or not
- C program to check syntax of 'for' loop
- Lex program to check whether given string is Palindrome or Not
- Lex program to check perfect numbers
- Lex program to check if a Date is valid or not
- YACC program to check whether given string is Palindrome or not
- 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 lines, spaces and tabs
- LEX program to count the number of vowels and consonants in a given string
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.