Click Here To Follow our Telegram Channel for more such news and amazing free stuffs.
Telegram Channel - https://t.me/codexelltech
import java.util.Scanner;
class ReverseNum
{
public static void main(String args[])
{
int n, reverse=0;
System.out.println("Enter an integer to reverse: ");
Scanner s= new Scanner(System.in);
n=s.nextInt();
while(n!=0)
{
reverse=reverse*10;
reverse=reverse + n%10;
n=n/10;
}
System.out.println("Reverse of the number is : " +reverse);
}
}
Output:
Enter a number:
155
Reverse number is = 551
Click Here To Follow our Telegram Channel for more such news and amazing free stuffs.
Telegram Channel - https://t.me/codexelltech
Click here to visit www.codexell.tech for more such references.
Telegram Channel - https://t.me/codexelltech
import java.util.Scanner;
class ReverseNum
{
public static void main(String args[])
{
int n, reverse=0;
System.out.println("Enter an integer to reverse: ");
Scanner s= new Scanner(System.in);
n=s.nextInt();
while(n!=0)
{
reverse=reverse*10;
reverse=reverse + n%10;
n=n/10;
}
System.out.println("Reverse of the number is : " +reverse);
}
}
Output:
Enter a number:
155
Reverse number is = 551
Click Here To Follow our Telegram Channel for more such news and amazing free stuffs.
Telegram Channel - https://t.me/codexelltech
Click here to visit www.codexell.tech for more such references.