Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Scanner;
- public class Game {
- public static void main(String[] args) {
- Scanner userInput = new Scanner(System.in);
- List<Integer> myList = new ArrayList<>(3);
- int digit = userInput.nextInt();
- while (digit > 0) {
- int number = digit % 10;
- digit /= 10;
- myList.add(digit);
- }
- int theBiggest = 0;
- theBiggest = Math.max(theBiggest, myList.get(0) + myList.get(1) + myList.get(2));
- theBiggest = Math.max(theBiggest, myList.get(0) * myList.get(1) + myList.get(2));
- theBiggest = Math.max(theBiggest, myList.get(0) + myList.get(1) * myList.get(2));
- theBiggest = Math.max(theBiggest, myList.get(0) * myList.get(1) * myList.get(2));
- System.out.println(theBiggest);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement