Advertisement
Guest User

Untitled

a guest
May 26th, 2017
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.59 KB | None | 0 0
  1. import java.lang.*;
  2. import java.util.*;
  3. class reversing{
  4. public static void main(String args []){
  5.  int a=23456789,b=0,e=10,c=1,n=0;
  6. //----------------------------finding its place-----------------------------
  7. for(;c!=0;){
  8. c=a/e;
  9. e=e*10;
  10. }
  11. if(c==0){
  12. e=e/100;
  13. }
  14. //-----------------------reversing the number-------------------------------
  15. c=10;
  16. if(e>=10){
  17. for(;e>=1;){
  18. b=a%c;
  19. a=a/c;
  20. System.out.println("b="+b+"a="+a+"c="+c);
  21. b=b*e;
  22. n=n+b;
  23. System.out.println("b="+b+"c="+c+"n"+n);
  24. e=e/10;
  25. System.out.println("e"+e);
  26. }}
  27. else{
  28. b=a/1;
  29. n=n+b;
  30. }
  31. System.out.println("final"+n);
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement