标签:style blog ar color os sp java on 数据
描述做了A+B Problem之后,Yougth感觉太简单了,于是他想让你求出两个数反转后相加的值。帮帮他吧
1234 1234
125 117
0 0
8642
1232
1 import java.util.Scanner; 2 3 public class Main { 4 public static void main(String[] args) { 5 Scanner scanner=new Scanner(System.in); 6 String a; 7 String b; 8 int number1; 9 int number2; 10 11 while(true){ 12 a=scanner.next(); 13 b=scanner.next(); 14 15 if(a.compareTo("0")==0 && b.compareTo("0")==0) 16 break; 17 18 a=new StringBuffer(a).reverse().toString(); 19 b=new StringBuffer(b).reverse().toString(); 20 number1=Integer.parseInt(a); 21 number2=Integer.parseInt(b); 22 System.out.println(number1+number2); 23 } 24 } 25 }
标签:style blog ar color os sp java on 数据
原文地址:http://www.cnblogs.com/zqxLonely/p/4133295.html