Arithmetic Examples

File Name: ArithmeticExamples.java

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
package basics.operators;

public class ArithmeticExamples {
  public static void main(String[] args) {
    int a = 150;
    int b = 100;
    System.out.println("Addition of 100 + 150:" + (a + b));
    System.out.println("Subraction of 150 - 100:" + (a - b));
    System.out.println("Multiplication of 100 * 150:" + (a * b));
    System.out.println("Division of 150 / 100:" + (a / b));
    System.out.println("Modulus of 150 % 100:" + (a % b));
    System.out.println("Pre Increment of 150:" + (++a));
    System.out.println("Post Decrement of 100:" + (b--));
  }

}
// javac basics/Operators/ArithmeticExamples.java &java basics.Operators.ArithmeticExamples