السؤال الثاني..
كود:
int x, z, result = 0, choice;
Scanner sc = new Scanner(System.in);
System.out.print("Please enter first number: ");
x = sc.nextInt();
System.out.print("Please enter second number: ");
z = sc.nextInt();
System.out.print("Please enter your choice: ");
choice = sc.nextInt();
switch (choice) {
case 1:
result = x + z;
break;
case 2:
result = x - z;
break;
case 3:
result = x * z;
break;
case 4:
result = x / z;
break;
}
System.out.println("The result is " + result);
بالتوفيق.. واي شي مو مفهوم لا تترددوا بالسوال