Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Expression {
- public static void main(String[] args) {
- Scanner in = new Scanner(System.in);
- int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
- int mul = a * b * c; // case 1
- int add = a + b + c; // case 2
- int addMul = (a + b) * c;
- int mulAdd = a + (b * c);
- int x = (a * b) + c;
- int y = a * (b + c);
- int max = Math.max(Math.max(Math.max(mul, add), Math.max(mulAdd, addMul)), Math.max(y, x));
- System.out.println(max);
- in.close();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement