Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

reverse number in java

import java.util.*;
class reverse
{
    public static void main(String args[])
    {
        Scanner sc = new Scanner(System.in);
        System.out.println("Enter String: ");
        String str = sc.next();
        char d;
        String str2 = "";
        int l = str.length();
        for(int i = l-1; i >= 0; i--)
        {
            d = str.charAt(i);
            str2 = str2 + d;
        }
        System.out.println(str2);
        sc.close();
    }
}
 
PREVIOUS NEXT
Tagged: #reverse #number #java
ADD COMMENT
Topic
Name
8+4 =