Skip to content

Instantly share code, notes, and snippets.

@gitaficionado
Created November 29, 2019 19:47
Show Gist options
  • Save gitaficionado/42a9132d9c68adda2b7a674625979aca to your computer and use it in GitHub Desktop.
Save gitaficionado/42a9132d9c68adda2b7a674625979aca to your computer and use it in GitHub Desktop.
(Display an integer reversed) Write a method with the following header to display an integer in reverse order:public static void reverse(int number)
/**
*(Display an integer reversed) Write a method with the following header
*to display an integer in reverse order:public static void reverse(int number)
*For example, reverse(3456) displays 6543. Write a test program that prompts the
*user to enter an integer and displays its reversal.
*/
public class SortThreeNumbers_06_04 {
public static void main(String[] args) {
System.out.print("Enter an integer: ");
java.util.Scanner input = new java.util.Scanner(System.in);
int ___________ = input.nextInt();
reverse(_________);
}
public static void ____________(int number) {
________ (number != 0) {
int remainder = number % 10;
System.out.print(_______);
_______ = _______ / 10;
}
System.out.println();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment