/home/caleb/ASDV-Java/Semester 3/Assignments/lab5-recursion2_CalebFontenot/src/main/java/edu/slcc/asdv/caleb/lab5/recursion2_calebfontenot/ReverseInt.java |
package edu.slcc.asdv.caleb.lab5.recursion2_calebfontenot;
import java.util.Scanner;
@author
public class ReverseInt {
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
System.out.print("Enter an integer: ");
int i = input.nextInt();
System.out.print("The reversal of " + i + " is ");
reverseDisplay(i);
System.out.println();
}
public static void reverseDisplay(int value) {
if (value != 0) {
System.out.print(value % 10);
value = value / 10;
reverseDisplay(value);
}
}
}