글
백준 10952번 A+B - 5(JAVA, C#) while문
자바
import java.util.*;
public class Main{
public static void main(String args[]){
Scanner sc = new Scanner(System.in);
while(true)
{
int a = sc.nextInt();
int b = sc.nextInt();
if(a == 0 && b == 0)
{
sc.close();
break;
}
System.out.println(a+b);
}
}
}
///////////////////////////
C#
using System;
namespace Baekjoon {
class Program {
static void Main(string[] args) {
while(true)
{
string[] s = Console.ReadLine().Split();
int a = int.Parse(s[0]);
int b = int.Parse(s[1]);
if(a == 0 && b == 0)
{
break;
}
Console.WriteLine(a+b);
}
}
}
}
'백준 프로그래밍' 카테고리의 다른 글
백준 1110번 더하기 사이클(JAVA, C#) (0) | 2023.02.15 |
---|---|
백준 10951번 A + B - 4(JAVA, C#) hasNextInt() (0) | 2023.02.15 |
백준 2439번 별 찍기 - 2(JAVA, C#) (0) | 2023.02.15 |
백준 별 찍기 - 1(JAVA, C#) (0) | 2023.02.14 |
백준 11022번 A + B - 8(JAVA, C#) (0) | 2023.02.14 |