Java Program to Addition of two numbers

Description

Get two integer numbers, add both the integers and dispaly the sum.
Input 1:
5 6
Output1:
11
Input2:
65 4
Output2:
69

Solution

import java.util.*;
class Addition
{
   public static void main(String args[])
   {
 
      int Input1,Input2,sum=0;
      Scanner sc=new Scanner(System.in);

      System.out.println("Enter The Input 1:");
      Input1=sc.nextInt();
      System.out.println("Enter The  Input 2:");
      Input2=sc.nextInt();
      sum=Input1+Input2;
      System.out.println("The Output Is:\n"+sum);
   }

}

Explanation

Get two integers Input1 and Input2 (using scanner class)

Add Input1 and Input2, then store the sum  (sum=Input1+Input2)

print the value of sum (using system.out.println)
Ramesh P Natarajan

Author - Ramesh P Natarajan

Learner, Professor, Technology Trainer, Software Developer and Content Marketer, very much passionate in the field of Software Application Development, Machine Learning and Search Engine Optimization.

Write to: admin@decodeschool.com





Interesting Pattern Programs: for more Patterns

Input:
5
Output:
*
**
***
****
*****
****
***
**
*Solution
Input:
5
Output:
    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *Solution
Input:
5
Output:
*        *
**      **
***    ***
****  ****
**********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********Solution
Input:
5
Output:
*       *
**     **
***   ***
**** ****
*********
**** ****
***   ***
**     **
*       *Solution
Input:
5
Output:
*********
 *******
  *****
   ***
    *
   ***
  *****
 *******
*********Solution