1

I have two numbers, for example:

1.51 and 1.56

I need to have:

1.55 and 1.60

but, if it is 1.55 it just stay as 1.55.

Raktim Biswas
  • 4,011
  • 5
  • 27
  • 32
Vaso Beruashvili
  • 678
  • 2
  • 7
  • 14

2 Answers2

4
public double MyCeiling(double value)
{
    return Math.Ceiling(value * 20) / 20;
}

Usage:

double d1 = MyCeiling(1.51); // result 1.55
double d2 = MyCeiling(1.55); // result 1.55
double d3 = MyCeiling(1.56); // result 1.6
Flat Eric
  • 7,971
  • 9
  • 36
  • 45
1

Try this.

Math.Ceiling(val*20)/20
Hari Prasad
  • 16,716
  • 4
  • 21
  • 35