Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class ReverseNum {
- public static int nlen(int n)
- {
- if (n<10)
- return 1;
- return 1+nlen(n/10);
- }
- public static int ex4(int n)
- {
- if (n<10)
- return n;
- return (n%10*(int)Math.pow(10,nlen(n)-1))+ex4(n/10);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement