fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[] args) throws java.lang.Exception
  11. {
  12. Scanner sc = new Scanner(System.in);
  13. System.out.println("---MENU---");
  14. System.out.println("Nhap so thu nhat: ");
  15. int s1 = sc.nextInt();
  16. System.out.println("Nhap so thu hai: ");
  17. int s2 = sc.nextInt();
  18. System.out.println("1. Cong hai so");
  19. System.out.println("2. Tru hai so");
  20. System.out.println("3. Nhan hai so");
  21. System.out.println("4. Chia hai so");
  22. System.out.println("Others - Quit")
  23. System.out.println("Lua chon cua ban la: ");
  24. int option = sc.nextInt();
  25. switch (option) {
  26. case 1:
  27. System.out.println("Tong cua hai so la: " + (s1+s2));
  28. case 2:
  29. System.out.println("Hieu cua hai so la: " + (s1-s2));
  30. case 3:
  31. System.out.println("Tich cua hai so la: " + (s1*s2));
  32. case 4:
  33. System.out.println("Thuong cua hai so la: " + (s1/s2));
  34. default:
  35. System.out.println("Bye Bye!");
  36. }
  37. }
  38. }
Success #stdin #stdout 0.07s 52652KB
stdin
5
3
1
stdout
---MENU---
Nhap so thu nhat: 
Nhap so thu hai: 
1. Cong hai so
2. Tru hai so
3. Nhan hai so
4. Chia hai so