杭電oj-1000(A+B Problem)

Problem Description

alculate  A + B.

Input

Each line will contain two integers A and B. Process to end
of file.

Output

For each case, output A + B in one line.

Sample Input

1 1

Sample Output

2

Author

HDOJ

簡述一下哈,最近真是無聊,真是沒事干,所以打算每天抽出幾個小時來做做題,正直七夕哈,祝大家有情人終成眷屬,表白的都成功,我打算敲一天代碼,new一天對象,??O(∩_∩)O哈哈~

當然這是最簡單的一道題啦,所以我就不說思路咯,說一下用java A題的應(yīng)該注意的事項:

1.必須要導(dǎo)包,千萬不能忘記了

2.類名必須為Main

3.要注意輸入、輸出的格式

代碼:


import java.util.Scanner;

public class Main1000 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        while (in.hasNextInt()) {
            int a = in.nextInt();
            int b = in.nextInt();
            System.out.println(a + b);
        }
    }
}


最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

推薦閱讀更多精彩內(nèi)容