Source Code
package MyPackage;
public class ArithmeticOperators {
public static void main(String[] args) {
int x , y , answer ;
// declare double for decimal values
x = 70;
y = 30;
answer = x / y;
/*
answer = x - y; -- returns subtraction
answer = x * y; -- returns multiplication
answer = x / y; -- returns integer value
answer = x % y; -- returns remainder
*/
System.out.println("Answer = " + answer);
}
}
Output
Answer = 2
0 Comments