fork download
  1. #include<stdio.h>
  2.  
  3. int pal(int num);
  4.  
  5. void main()
  6.  
  7. {
  8.  
  9. int num=625,res=0;
  10.  
  11. res=pal(num);
  12.  
  13. printf("%d",res);
  14. getch();
  15. }
  16.  
  17. int pal(int num)
  18.  
  19. {
  20.  
  21. int ans=0,rem=0,index=0;
  22.  
  23. index=log10(num);
  24.  
  25. if(index==0)
  26. {
  27. return ;
  28. }
  29.  
  30. index--;
  31.  
  32. rem=num%10;
  33. ans=ans*10+rem;
  34. return pal(index--);
  35.  
  36. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:5:11: error: ‘::main’ must return ‘int’
 void main()
           ^
prog.cpp: In function ‘int main()’:
prog.cpp:14:11: error: ‘getch’ was not declared in this scope
     getch();
           ^
prog.cpp: In function ‘int pal(int)’:
prog.cpp:23:20: error: ‘log10’ was not declared in this scope
     index=log10(num);
                    ^
prog.cpp:27:9: error: return-statement with no value, in function returning ‘int’ [-fpermissive]
         return ;
         ^~~~~~
stdout
Standard output is empty