Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.61 KB | None | 0 0
  1.  
  2.         double zahl1;
  3.         double zahl2;
  4.         char operator;
  5.        
  6.         Scanner scn = new Scanner(System.in);
  7.         System.out.println("Gib eine zahl ein: ");
  8.         zahl1 = scn.nextInt();
  9.        
  10.         System.out.println("Gib einen Operatoren ein: ");
  11.         operator = scn.next().charAt(0);
  12.        
  13.         System.out.println("Gib die zweite Zahl ein:");
  14.         zahl2 = scn.nextInt();
  15.        
  16.         if (operator == '+'){
  17.             System.out.println(zahl1 + zahl2);
  18.         } else if (operator == '-') {
  19.             System.out.println(zahl1 - zahl2);
  20.         } else if (operator == '*') {
  21.             System.out.println(zahl1 - zahl2);
  22.         } else if (operator == '/') {
  23.             System.out.println(zahl1 / zahl2);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement