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 first = left + mid + right;
- int second = left + mid * right;
- int third = left * mid * right;
- int fourth = left * mid + right;
- int max = first;
- if (second > max) {
- max = second;
- } else if (third > max) {
- max = third;
- } else if (fourth > max) {
- max = fourth;
- }
- System.out.println(max);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement