1234567891011121314151617181920212223242526272829303132 |
- import java.util.Scanner;
-
-
- public class ShortCalculator {
-
-
- public static void main(String[] args){
-
- Scanner scanner = new Scanner(System.in);
-
- System.out.println("Please enter a number:");
- short num = scanner.nextShort();
-
- System.out.println("Please enter another number:");
- short num2 = scanner.nextShort();
-
- short a = (short)(num + num2);
- short s = (short)(num - num2);
- short m = (short)(num * num2);
- short d = (short)(num / num2);
- short r = (short)(num % num2);
-
- System.out.println("The sum of x and y: " + a);
- System.out.println("The difference of x and y: " + s);
- System.out.println("The multiplication of x and y: " + m);
- System.out.println("The division of x and y: " + d);
- System.out.println("The remainder of x and y: " + r);
- }
-
- }
-
|