Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Game {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- int number = scanner.nextInt();
- int left = number / 100;
- int mid = (number / 10) % 10;
- int right = number % 10;
- int result1 = left + mid + right;
- int result2 = left * mid * right;
- int result3 = left + mid * right;
- int max = result1;
- if (result2 > max) {
- max = result2;
- }
- if (result3 > max) {
- max = result3;
- }
- System.out.println(max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement