Wednesday, September 9, 2015

Basic Java Example, Standard I/O, Get get numbers using standard input and display sum of two numbers

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
import java.util.*;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        int a, b;
        a = sc.nextInt();
        b = sc.nextInt();
        System.out.println(a + b);
    }
}

No comments:

Post a Comment