Computer Science, asked by saanvi0001, 1 year ago

write a program to reverse a 3 digit number in java​

Answers

Answered by raajbharwada
1

Answer:

public class Reverse

{

public static void main(String args[])

{

}

}

Explanation:


saanvi0001: can u please give the whole program
Answered by Shivu516
0

       This program can also reverse numbers having more than 3 digits

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