fork download
  1. %{
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. %}
  5.  
  6. %%
  7.  
  8. [0-9]+ { yylval = atoi(yytext); return NUMBER; }
  9. \n { return 0; }
  10.  
  11. %%
  12.  
  13. int main() {
  14. int num1, num2, sum;
  15.  
  16. printf("Enter first number: ");
  17. scanf("%d", &num1);
  18.  
  19. printf("Enter second number: ");
  20. scanf("%d", &num2);
  21.  
  22. sum = num1 + num2;
  23.  
  24. printf("The sum of %d and %d is: %d\n", num1, num2, sum);
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout #stderr 0.02s 6952KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
ERROR: /home/fG5OgI/prog:27:1: Syntax error: Unexpected end of file
ERROR: '$runtoplevel'/0: Undefined procedure: program/0
   Exception: (3) program ? EOF: exit