0
点赞
收藏
分享

微信扫一扫

HDOJ1_a+b

小_北_爸 2023-02-20 阅读 85


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.

import java.util.Scanner;

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

输入两个数,打印其和
hasNext()方法判断时候有下一个输入的数据
while保证有多组数据


举报

相关推荐

0 条评论