So your saying to do it like this:
import java.util.Scanner;
import java.text.DecimalFormat;
public class ReverseNumber {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.print("Enter a positive integer: ");
long input = s.nextLong();
long temp= input*2;
long result = reverse(temp);
DecimalFormat myFormatter = new DecimalFormat("#,##0");
System.out.println(myFormatter.format(input) + " doubled is " + myFormatter.format(input*2) + " and then reversed is " + myFormatter.format(reverse(result)));
}
public static long reverse(long n) {
long result = 0;
long rem;
while (n > 0) {
rem = n % 10;
n = n / 10;
result = result * 10 + rem;
}
return result;
}
}
Doing it this way will make be like input being 20, doubled is 40 and reversed 40? Doesn't doing it this way make doubled show up in twice rather than making one of the doubles flip/reverse (i think i worded that awkwardly). Here is an error log that i got (I think i may have forgot to do something in the code):
First Difference Occurs at: byte 82, line 1
On Line 1 its column 82
Line 1 Wrong: Enter a positive integer: 52,010,023 doubled is 104,020,046 and then reversed is 104,020,046
Line 1 Right: Enter a positive integer: 52,010,023 doubled is 104,020,046 and then reversed is 640,020,401
You have only a First Line Error