Write a function solution that, given an integer N, returns the maximum possible value obtained by inserting one '5' digit inside the decimal representation of integer N.
Answers
Answered by
52
Answer:
public int firstfunction (int N) {
var stringvalue = N.ToString();
var maximumvalue = int.MinValue;
for (int j1 = (N < 0) ? 1 : 0; j1 <= stringvalue .Length; ++j1) {
var testvalue= Int32.Parse(s.Insert(j1, "5"));
if (maximumvalue < testvalue)
maximumvalue = testvalue;
}
return maximumvalue ;
}
The above code is explaining the need of the problem, here we have taken a function name firstfunction() with a parameter named N and returnign the maximumvalue after adding 5 to it.
Similar questions