計算滯納金

zyip發表於2013-11-22
        static void Main(string[] args)
        {
            var r = abc(2);
            Console.Write(r.Key + "=" + r.Value);
            Console.Read();
        }

        static System.Collections.Generic.KeyValuePair<string,int> abc(int n)
        {
            n = n + 1;
            int k = 25;
            string str = "";
            int r = 0;
            System.Collections.Generic.KeyValuePair<string, int> result;
            for (int i = 1; i < n; i++)
            {
                if (i == 1)
                {
                    str = k.ToString();
                    r = k;
                }
                else
                {
                    r = r + k * i;
                    str = str + "+" + k * i;
                }
                //Console.WriteLine(str);
            }
            result = new KeyValuePair<string, int>(str, r);
            return result;
        }

 

 

相關文章