Reverse Integer


  • 0
    S

    public class Problem2 {
    public static void main(String arg[]){
    int data=120;
    int rnum = 0;
    int num = 0;
    while(data != 0){
    num=data%10;
    data= data/10;
    rnum=rnum*10+num;
    }
    System.out.println("print rnum: "+rnum);
    }

    }


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.