Use of EOF in JAVA programming


import java.util.Scanner;

public class UseOfEOF {

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

}

No comments:

Post a Comment