/* declaration section in this sections we will declare the different value and include the header file which we are using in this program to run this program */
%{
#include<stdio.h>
#include<stdlib.h>
int i;
%}
/* defined section */
%%
[0-9]+ {i=atoi(yytext); if(i%2==0) printf("Even !"); else printf("Odd !");}
%%
int main()
{
yylex();
}
How to run this program
save the file as "even_odd.l"
open terminal and run " flex even_odd.l "
it generates c file run " cc lex.yy.c -o evenodd -ll " as out put in file count
That's dumb.
ReplyDeleteReplace :
[0-9]+ {i=atoi(yytext); if(i%2==0) printf("Even !"); else printf("Odd !");}
By
[0-9]*[02468] { printf ("Even!"); }
[0-9]*[13579] {printf ("Odd!); }
How to play Coin Casino: a Bitcoin Casino - Casino
ReplyDeleteCoin Casino offers online 샌즈카지노 slots games with BTC, Ethereum, Litecoin, Dash, Dash, Litecoin and more, so 제왕 카지노 that you can take advantage of its range of 인카지노