Untitled

mail@pastecode.io avatar
unknown
java
2 years ago
2.1 kB
5
Indexable
Never
import java.util.Scanner;

public class App {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);

        System.out.println("TITLE PROGRAM (YOUR NAME)");
        System.out.println("CHOOSE YOUR OPERATOR");
        System.out.println("1. Arithmetic Operator\n2.Relational Operator\n3. Assignment Operator");
        int choose = sc.nextInt();

        System.out.print("Enter First Number : ");
        int num1 = sc.nextInt();
        System.out.print("Enter Second Number : ");
        int num2 = sc.nextInt();

        switch(choose){
            case 1:

                int addition = num1+num2;
                int subtraction = num1-num2;
                int multiplication = num1*num2;
                int division = num1/num2;
                int percentage = num1%num2;

                System.out.println("1. "+addition);
                System.out.println("2. "+subtraction);
                System.out.println("3. "+multiplication);
                System.out.println("4. "+division);
                System.out.println("5. "+percentage);
                break;
            case 2:
                boolean equals = num1 == num2; 
                boolean not =   num1 != num2;
                boolean more = num1 >= num2;
                boolean less = num1 <= num2;

                System.out.println(equals);
                System.out.println(not);
                System.out.println(more);
                System.out.println(less);
                break;
            case 3:
                int plus = num1 += num2;
                int minus = num1 -= num2;
                int times = num1 *= num2;
                int divide = num1 /= num2;
                int percent = num1 %= num2;

                System.out.println(plus);
                System.out.println(minus);
                System.out.println(times);
                System.out.println(divide);
                System.out.println(percent);
                break;


        }
    }
}