Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Expression {
  4.  
  5. public static void main(String[] args) {
  6. Scanner in = new Scanner(System.in);
  7. int a = in.nextInt(), b = in.nextInt(), c = in.nextInt();
  8.  
  9. int mul = a * b * c; // case 1
  10. int add = a + b + c; // case 2
  11. int addMul = (a + b) * c;
  12. int mulAdd = a + (b * c);
  13. int x = (a * b) + c;
  14. int y = a * (b + c);
  15. int max = Math.max(Math.max(Math.max(mul, add), Math.max(mulAdd, addMul)), Math.max(y, x));
  16. System.out.println(max);
  17.  
  18. in.close();
  19.  
  20. }
  21.  
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement