EOF (End Of File) νμΌμ λ : λ°μ΄ν°κ° λμ΄μ μ‘΄μ¬νμ§ μμ λ
-> μ λ ₯μμ λμ΄μμ μ½μ μ μλ λ°μ΄ν°κ° μ‘΄μ¬νμ§ μμ λ λ°λ³΅λ¬Έμ μ’ λ£νλ κ².
=> trueλμ hasNextInt()λ₯Ό μ
μ΄λ‘ μΈν΄ hasNextInt()λ‘ μ μλ₯Ό μ λ ₯νμ§ μμ κ²½μ°, μμΈλ₯Ό λμ§λ©° μ λ ₯ λ°μ§ μκ³ λ°λ³΅λ¬Έ μ’ λ£
μ λ ₯μ΄ λμ΄μ μ£Όμ΄μ§μ§ μμ λ μ΄λ»κ² μ²λ¦¬ν΄μΌ νλ κ°λ₯Ό μ μ μμ.
import java.util.Scanner;
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)){
break;
}
System.out.println((a+b));
}
}
}
import java.util.Scanner;
public class Main{
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
while(sc.hasNextInt()){
int a = sc.nextInt();
int b = sc.nextInt();
System.out.println(a+b);
}
}
}