Skip to main content

Calculate possible ceiling max values based on denominator


                double higherMaxValue = 100;
		double maxValue = 1235;
		int cntDigit = maxValue >= 10 ? maxValue.ToString().Length : 1;
		int denominator = (int)Math.Pow(10, cntDigit - 1);
		higherMaxValue = maxValue + denominator - (maxValue % denominator);
		Console.WriteLine("maxValue:"+maxValue+" higherMaxValue:"+higherMaxValue);
                  //maxValue:1235 higherMaxValue:2000

Comments

Popular posts from this blog

how to check powershell version

 Run powershell as administrator      Run below command $PSVersionTable.PSVersion