46 lines
1.2 KiB
Java
46 lines
1.2 KiB
Java
import java.io.*;
|
|
import java.util.*;
|
|
|
|
class A3 {
|
|
static {
|
|
System.loadLibrary("A3");
|
|
}
|
|
|
|
private native int add(int a, int b);
|
|
private native int sub(int a, int b);
|
|
private native int mult(int a, int b);
|
|
private native int div(int a, int b);
|
|
|
|
public static void main(String[] args) {
|
|
Scanner sc = new Scanner(System.in);
|
|
int a, b, ch;
|
|
|
|
System.out.println("\nEnter value of a : ");
|
|
a = sc.nextInt();
|
|
System.out.println("\nEnter value of b : ");
|
|
b = sc.nextInt();
|
|
|
|
do {
|
|
System.out.println("\nENTER YOUR CHOICE : ");
|
|
ch = sc.nextInt();
|
|
switch (ch) {
|
|
case 1:
|
|
new A3().add(a, b);
|
|
break;
|
|
case 2:
|
|
new A3().sub(a, b);
|
|
break;
|
|
case 3:
|
|
new A3().mult(a, b);
|
|
break;
|
|
case 4:
|
|
new A3().div(a, b);
|
|
break;
|
|
default:
|
|
System.out.println("Your choice is wrong.");
|
|
}
|
|
} while (ch < 5);
|
|
}
|
|
}
|
|
|