Write a program in Java to print a given number with its digits in reverse.
Answers
Answered by
5
Answer:
ReverseNumberExample4.java
import java.util.*;
public class ReverseNumberExample4.
{
public static void main(String args[])
{
System.out.print("Enter the number that you want to reverse: ");
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
Explanation:
please mark me as brainliest answer ❤️
Answered by
0
Answer:
import java.util.Scanner;
public class NumberReverser {
int reverse = 0;
public static void main(String [] args){
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number: ");
StringBuilder number = new StringBuilder(sc.next());
System.out.print("The reversed number is ");
System.out.print(number.reverse());
}
}
Output:
Enter a number: 123456789
The reversed number is 987654321
Similar questions
Biology,
3 months ago
English,
3 months ago
Accountancy,
3 months ago
Math,
7 months ago
Computer Science,
7 months ago
Math,
1 year ago