Created
July 7, 2014 16:03
-
-
Save IsaacCisneros/b4d9f07475bed23d48d4 to your computer and use it in GitHub Desktop.
SPOJ/ADDREV
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class Main { | |
public static void main(String[] args) { | |
Scanner scanner = new Scanner(System.in); | |
int steps = scanner.nextInt(); | |
for(int x=0; x<steps; x++){ | |
System.out.println(reverse(reverse(scanner.nextInt()) + reverse(scanner.nextInt()))); | |
} | |
} | |
public static int reverse(int number){ | |
int reverse = 0; | |
while(number!=0){ | |
reverse = reverse*10 + number%10; | |
number /= 10; | |
} | |
return reverse; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment