Answers for "13. write a program to print reverse of a given number in java"

C
1

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();
    }
}
Posted by: Guest on March-15-2022

Code answers related to "13. write a program to print reverse of a given number in java"

Code answers related to "C"

Browse Popular Code Answers by Language