Advertisement
Guest User

Untitled

a guest
Sep 18th, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1.  
  2. import java.util.Scanner;
  3.  
  4.  
  5. public class SwitchCase {
  6.  
  7. public static void main(String[] args){
  8.  
  9. int num1, num2, result;
  10. Scanner input = new Scanner(System.in);
  11.  
  12. System.out.println (" **** Arithemtic Operations****");
  13. System.out.println (" **** Switch case demo ****");
  14.  
  15. System.out.println(" Enter two integers");
  16. num1= input.nextInt();
  17. num2= input.nextInt();
  18.  
  19. System.out.println (" + ==> Additon - ==> Subtraction");
  20. System.out.println(" Enter your choice");
  21.  
  22. char choice;
  23. choice = input.next().charAt(0);
  24.  
  25. switch ( choice){
  26.  
  27. case '+' :
  28. System.out.println( " Your choice is Addition");
  29. break;
  30. case '-' :
  31. System.out.println( " Your choice is Subtraction");
  32. break;
  33.  
  34.  
  35. }
  36.  
  37. }
  38.  
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement