求兩個整數(shù)A+B的和。
輸入包含多組數(shù)據(jù)。每組數(shù)據(jù)包含兩個整數(shù)A(1 ≤ A ≤ 100)和B(1 ≤ B ≤ 100)。
對于每組數(shù)據(jù)輸出A+B的和。
1 23 45 6樣例輸出
3711java 代碼示例1:
import java.util.Scanner;public class Main { public static void main(String[] args) { Scanner in = new Scanner(System.in); while(in.hasNext()) { int a = in.nextInt(); int b = in.nextInt(); System.out.println(a + b); } }}
java 代碼示例2:
import java.util.Scanner;
public class Main { public static void main(String[] args){ Scanner scan = new Scanner(System.in); while(scan.hasNext()){ String s = scan.nextLine(); int a = Integer.parseInt(s.split(" ")[0]); int b = Integer.parseInt(s.split(" ")[1]); System.out.println(a+b); } }}
新聞熱點(diǎn)
疑難解答