Saturday, May 30, 2015

Arithmetic Operator

package OperatorsDemo;

public class ArithmeticOperatorDemo {

public static void main(String[] args) {

int a = 10;
int b= 20;
int c = 30;
int d = 5;

System.out.println(" a+b=   "+ (a+b));
System.out.println(" a-b=    "+ (a-b));
System.out.println(" a*b=    "+ (a*b));
System.out.println(" a/b=    "+ (a/b));
System.out.println(" a%b=  "+ (a%b));
System.out.println(" b%a=  "+ (b%a));
System.out.println("c++      "+ (c++));
System.out.println("++c      "+ (++c));
System.out.println("++d      "+ (++d));
}
}


No comments:

Post a Comment