Skip to content

Instantly share code, notes, and snippets.

@IsaacCisneros
Created July 7, 2014 16:03
Show Gist options
  • Save IsaacCisneros/b4d9f07475bed23d48d4 to your computer and use it in GitHub Desktop.
Save IsaacCisneros/b4d9f07475bed23d48d4 to your computer and use it in GitHub Desktop.
SPOJ/ADDREV
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