Sum of two number in java

Example 

Input 
5 6 

Output 
11 

Steps 

  1. Take two numbers as input from the user. 
  2. Use the arithmetic operator addition'(+)' to perform the sum of two numbers. 
  3. Print the result. 

Programs 

import java.util.Scanner; 
class Main {
  public static void main(String[] args) {
    //Scanner 
    Scanner sc = new Scanner(System.in); 
    //take input
    int a,b,c;
    //take two input 
    a = sc.nextInt(); 
    b = sc.nextInt(); 
    c = a + b;
    System.out.println(+c);
  }
}

Comments