123456789101112131415161718192021222324252627282930 |
-
-
-
- public class ShortCalculator {
- public static void main(String[] args) {
- short x = 12121;
- short y = 21212;
- System.out.println("Sum = " + sum(x, y));
- System.out.println("Difference = " + difference(x, y));
- System.out.println("Remainder = " + remainder(x, y));
- System.out.println("Product = " + product(x, y));
- System.out.println("Quotient = " + quotient(x, y));
- }
- public static short sum(short x, short y) {
- return (short)(x + y);
- }
- public static short difference(short x, short y) {
- return (short)(x - y);
- }
- public static short remainder(short x, short y) {
- return (short)(x % y);
- }
- public static short product(short x, short y) {
- return (short)(x * y);
- }
- public static short quotient(short x, short y) {
- return (short)(x / y);
- }
- }
|