fork(1) download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main() {
  5. cout<<"reverse number program\n";
  6. int a;
  7. cout<<"enter the number\n";
  8. cin>>a;
  9. int rem,mul=1,ans=0;
  10. while(a){
  11. rem=a%10;
  12. a/=10;
  13. ans+=rem*mul;
  14. mul*=10;
  15.  
  16. }
  17.  
  18. cout<<ans;
  19. return 0;
  20. }
Success #stdin #stdout 0.01s 5288KB
stdin
10
stdout
reverse number program
enter the number
10