Guest User

Untitled

a guest
Jun 11th, 2019
90
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.*;
  2. import java.lang.*;
  3.  
  4. public class Main {
  5.  
  6. public static void main(String[] args) {
  7.  
  8. int x;
  9. int y;
  10. char znak;
  11. Scanner scanner = new Scanner(System.in);
  12.  
  13. while (true) {
  14. znak = scanner.next().charAt(0);
  15. System.out.print("");
  16. x = scanner.nextInt();
  17. y = scanner.nextInt();
  18. if (znak == '*') {
  19. int z = x * y;
  20. System.out.println(z);
  21. } else if (znak == '-') {
  22. int z = x - y;
  23. System.out.println(z);
  24. } else if (znak == '+') {
  25. int z = x + y;
  26. System.out.println(z);
  27. } else if (znak == '/') {
  28. int z = x / y;
  29. System.out.println(z);
  30. } else if (znak == '%') {
  31. int z = x % y;
  32. System.out.println(z);
  33. }
  34. else break;
  35. }
  36.  
  37. }
  38. }
RAW Paste Data