Menu



Java program for Reverse of a number


reversenumber.java

import java.util.Scanner;
class ReverseOfNumber
{
public static void main(String args[])
{
int n, rev = 0;
System.out.println("Enter the number:");
Scanner in = new Scanner(System.in);
n = in.nextInt();
while( n != 0 )
{
rev = rev * 10;
rev = rev + n%10;
n = n/10;
}
System.out.println("The reversed value is: "+rev);
}
}

Output

reverse









Connection failed: SQLSTATE[28000] [1045] Access denied for user 'studentdb'@'localhost' (using password: YES)

Subscribe