Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  a.l
Language: C/C++
Code:
%{ 
  #include<stdio.h> 
  int num, r, b=0, p=1; 
%} 
  
DIGIT [0-9] 

%% 
{DIGIT}+   { num=atoi(yytext); 
             while (num > 0) 
             { 
              r= num % 2; 
              b+= r*p; 
              p*= 10; 
              num/= 2; 
             } 
              printf("%d", b); 
            } 
.|\n    ECHO; 
         
%% 
 
int main() 

    yylex(); 
    return 0; 
}       
Comments: