Showing posts with label Addition in Java. Show all posts
Showing posts with label Addition in Java. Show all posts

Friday, 18 July 2014

How to Add Two Numbers in Java

Structure of Problem Requirements 

In this Simple Problem we just add two Number in Java . We Write this Code in Command Prompt and use very Simple way to get Better Understand of Java.

Source Code   


import java.util.Scanner;

public class Addition {

    public static void main(String[] args) {
    int a,b,c=0;
    Scanner s = new Scanner (System.in);
    System.out.println("Enter Number ");
    a = s.nextInt();
    System.out.println("Enter Number ");
    b = s.nextInt();
    c = a+b;
    System.out.println (c);
        
    }
    
}

Output of the Program

How to add two numbers in java
Adding two Numbers