1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
/* Arithmetic Operators Example This example shows how to use Java Arithmetic operators like + (addition), - (subtraction), * (multiplication) and / (division). */ public class ArithmeticOperatorsExample { public static void main(String[] args) { System.out.println("Arithmetic operators example :"); int i = 50 + 20; int j = i - 10; int k = j * 2; double l = k / 6; System.out.println("i = " + i); System.out.println("j = " + j); System.out.println("k = " + k); System.out.println("l = " + l); } } /* Output would be Arithmetic operators example : i = 70 j = 60 k = 120 l = 20.0 */ |
Add Comment