Advertisement
CR7CR7

game

Jul 20th, 2023
1,445
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.82 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Game
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.  
  12.             string n = Console.ReadLine();
  13.  
  14.             List<int> number = n.ToString()
  15.                 .Select(x => Convert.ToInt32(x.ToString()))
  16.                 .ToList();
  17.  
  18.             int case1 = number[0] + number[1] + number[2];
  19.  
  20.             int case2 = number[0] * number[1] + number[2];
  21.  
  22.             int case3 = number[0] + number[1] * number[2];
  23.  
  24.             int case4 = number[0]*number[1]*number[2];
  25.  
  26.             //int case5 = number[0] * number[1] * number[2];
  27.  
  28.            
  29.  
  30.             int result = Math.Max(case1,(Math.Max(case2,(Math.Max(case3,case4)))));
  31.  
  32.             Console.WriteLine(result);
  33.  
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement