Advertisement
CR7CR7

Hadziev96

Dec 30th, 2023
1,294
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Game {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         int number = scanner.nextInt();
  7.        
  8.         int left = number / 100;
  9.         int mid = (number / 10) % 10;
  10.         int right = number % 10;
  11.        
  12.         int result1 = left + mid + right;
  13.         int result2 = left * mid * right;
  14.         int result3 = left + mid * right;
  15.        
  16.         int max = result1;
  17.        
  18.         if (result2 > max) {
  19.             max = result2;
  20.         }
  21.         if (result3 > max) {
  22.             max = result3;
  23.         }
  24.        
  25.         System.out.println(max);
  26.     }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement