We always get maximum sum if we replace 5 with 6.
int maxSum = replaceDig ( x1 , 5 , 6 ) + replaceDig ( x2 , 5 , 6 ) ; Console . Write ( " Minimum ▁ sum ▁ = ▁ " + minSum ) ; Console . Write ( " STRNEWLINE Maximum ▁ sum ▁ = ▁ " + maxSum ) ; }