Monday 4 May 2015

C# Math.Ceiling

  try
            {
                string ss = "1.2677";            
                int d = (int)Math.Ceiling(float.Parse(ss));

                Response.Write(d);

                double[] values = { 7.03, 7.64, 0.12, -0.12, -7.1, -7.6 };
                Console.WriteLine("  Value          Ceiling          Floor\n");
                foreach (double value in values)
                    Console.WriteLine("{0,7} {1,16} {2,14}",
                                      value, Math.Ceiling(value), Math.Floor(value));

            }
            catch (Exception)
            {

                throw;
            }