Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Scanner scanner=new Scanner(System.in);
- String line = scanner.nextLine();
- while (!line.equals("end"))
- {
- int num1=line.charAt(0)-'0';
- int num2=line.charAt(2)-'0';
- char op = line.charAt(1);
- int result=0;
- if (op=='+')
- result=num1+num2;
- System.out.println(result);
- line = scanner.nextLine();
- }
Advertisement
Add Comment
Please, Sign In to add comment