Monday, August 4, 2014

How to add,subtract,multply and division of two number in java

How to add,subtract,multply and division of two number in java 
   import java.util.*;
  public class TestTwo
    {
    public static void main(String args[])
    {
        int a,b;
    Scanner sc=new Scanner(System.in);
      System.out.println("Enter any two number");
      a=sc.nextInt();
     b=sc.nextInt();

   System.out.println("The Sum of Two Number "+(a+b));
   System.out.println("The Subtraction of Two Number "+(a-b));
   System.out.println("The Multiplication of Two Number "+(a*b));
   System.out.println("The Division of Two Number "+(a/b));
}
}
 output:
   Enter any two number..
  20
10
 The Sum of Two Number 30
 The Subtraction of Two Number 10
 The Multiplication of Two Number 200
 The Division of Two Number 2

No comments:

Post a Comment

Featured Post

What is JavaScript? What is the role of JavaScript engine?

  The JavaScript is a Programming language that is used for converting static web pages to interactive and dynamic web pages. A JavaScript e...