本帖最后由 daisyding1984 于 2013-02-24 15:12:24 编辑

解决方案 »

  1.   

                double a = 243.0;
                int b = 3;
                int r = (int)(((int)a / (double)10 / (double)b) + 0.9999) * 10;
      

  2.   

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                double[] a = { -100.00, -1.0, 0.0, 29, 30, 31, 200.00, 243, 243.0, 269.99, 270.00, 270.01, 300.00, 302.0 };
                int b = 3;
                Func<double, int, int> foo = (x, y) => (int)((x / (double)10 / (double)y) + 0.99999) * 10;
                foreach (double d in a)
                    Console.WriteLine("{0}\t{1}", d, foo(d, b));
            }
        }
    }-100    -20
    -1      0
    0       0
    29      10
    30      10
    31      20
    200     70
    243     90
    243     90
    269.99  90
    270     90
    270.01  100
    300     100
    302     110
    Press any key to continue . . .