Lex Program to Check valid Mobile Number (10 Digits)

Lex Program to Check valid Mobile Number (10 Digits)

Thumnail Lex Peogram

Source Code:
%{
#include<stdio.h>
%}

%%
[\n] {printf("\n\nEnter mobile Number: ");}

[1-9][0-9]{9} {printf("Mobile number Valid.");}

.* {printf("Mobile number Invalid.");}
%%

int main()
{
printf("\nEnter mobile Number: ");
yylex();
return 0;
}
Output:
Output for Check valid Mobile Number

  • For any query, please comment below.
SUBSCRIBE

Post a Comment

0 Comments