等额本金法计算贷款还款利息等详细数据

时间:2021-03-28 05:34:42

等额本金法

  等额本金法最大的特点是每月的还款额不同,呈现逐月递减的状态;它是将贷款本金按还款的总月数均分,再加上上期剩余本金的利息,这样就形成月还款额,所以等额本金法第一个月的还款额最多 ,然后逐月减少,越还越少,计算公式为:

 

  每月还本付息金额=(本金/还款月数)+(本金-累计已还本金)×月利率

  每月本金=总本金/还款月数

  每月利息=(本金-累计已还本金)×月利率

    还款总利息=(还款月数+1)*贷款额*月利率/2

  还款总额=(还款月数+1)*贷款额*月利率/2+贷款额

 

 

namespace ConsoleApplication28
{
    class Program
    {
        static void Main(string[] args)
        {
            double m, n, d = 0.0655, e = 0.0405, x, y, z,p,q,h;
            Console.Write("请选择房贷类型?A商业贷款;B公积金贷款:");
            string a = Console.ReadLine();
            if (a=="A")
            {
                Console.Write("请选择房贷期限?A10年;B20;年C30年 :");
                string b = Console.ReadLine();
                if (b=="A")
                {
                    Console.Write("请输入贷款金额:");
                    m = Convert.ToInt32(Console.ReadLine());
                    Console.Write("请输入第几个还款月:");
                    n = Convert.ToInt32(Console.ReadLine());
                    x = m / 120;
                    y = x + (m-x)* (d/12);
                    z = x + (m - (n - 1)*x) * (d / 12);
                    p = (120 + 1) * m * (d / 12) / 2;
                    q = p + m;
                    Console.WriteLine("您当前月份的还款金额为:" + z);
                    Console.WriteLine("您每期偿还的本金为:" + x);
                    Console.WriteLine("您的最大月供为:" + y);                  
                    Console.WriteLine("您应当还款的总利息为:" + p);
                    Console.WriteLine("您应当还款的总金额为:" + q);
                    for (int i = 0; i < 120; i++)
                    {
                        h = x + (m - i*x) * (d / 12);
                        Console.WriteLine(""+(i+1)+"还款:"+h+"当月偿还的利息为:"+(h-x)+"剩余本金为:"+(m-x*(i+1)));

                    }
                    
                }
                else if (b=="B")
                {
                    Console.Write("请输入贷款金额:");
                    m = Convert.ToInt32(Console.ReadLine());
                    Console.Write("请输入第几个还款月:");
                    n = Convert.ToInt32(Console.ReadLine());
                    x = m / 180;
                    y = x + (m - x) * (d / 12);
                    z = x + (m - (n - 1) * x) * (d / 12);
                    p = (180 + 1) * m * (d / 12) / 2;
                    q = p +m;
                    Console.WriteLine("您当前月份的还款金额为:" + z);
                    Console.WriteLine("您每期偿还的本金为:" + x);
                    Console.WriteLine("您的最大月供为:" + y);
                    Console.WriteLine("您应当还款的总利息为:" + p);
                    Console.WriteLine("您应当还款的总金额为:" + q);
                    for (int i = 0; i < 180; i++)
                    {
                        h = x + (m - i * x) * (d / 12);
                        Console.WriteLine("" + (i + 1) + "还款:" + h + "当月偿还的利息为:" + (h - x) + "剩余本金为:" + (m - x * (i + 1)));

                    }

                }
                else if (b=="C")
                {
                    Console.Write("请输入贷款金额:");
                    m = Convert.ToInt32(Console.ReadLine());
                    Console.Write("请输入第几个还款月:");
                    n = Convert.ToInt32(Console.ReadLine());
                    x = m / 240;
                    y = x + (m - x) * (d / 12);
                    z = x + (m - (n - 1) * x) * (d / 12);
                    p = (240 + 1) * m * (d / 12) / 2;
                    q = p + m;
                    Console.WriteLine("您当前月份的还款金额为:" + z);
                    Console.WriteLine("您每期偿还的本金为:" + x);
                    Console.WriteLine("您的最大月供为:" + y);
                    Console.WriteLine("您应当还款的总利息为:" + p);
                    Console.WriteLine("您应当还款的总金额为:" + q);
                    for (int i = 0; i < 240; i++)//依次列出每个月应该还多少,利息多少,剩余多少,for循环
                    {
                        h = x + (m - i * x) * (d / 12);
                        Console.WriteLine("" + (i + 1) + "还款:" + h + "当月偿还的利息为:" + (h - x) + "剩余本金为:" + (m - x * (i + 1)));

                    }
                }
                else
                {
                    Console.WriteLine("请您选择正确的代号!");
                }

                
            }
            else if (a=="B")
            {
                Console.Write("请选择房贷期限?A10年;B20;年C30年 :");
                string b = Console.ReadLine();
                if (b == "A")
                {
                    Console.Write("请输入贷款金额:");
                    m = Convert.ToInt32(Console.ReadLine());
                    Console.Write("请输入第几个还款月:");
                    n = Convert.ToInt32(Console.ReadLine());
                    x = m / 120;
                    y = x + (m - x) * (e / 12);
                    z = x + (m - (n - 1) * x) * (e / 12);
                    p = (120 + 1) * m * (e / 12) / 2;
                    q = p + m;
                    Console.WriteLine("您当前月份的还款金额为:" + z);
                    Console.WriteLine("您每期偿还的本金为:" + x);
                    Console.WriteLine("您的最大月供为:" + y);
                    Console.WriteLine("您应当还款的总利息为:" + p);
                    Console.WriteLine("您应当还款的总金额为:" + q);
                    for (int i = 0; i < 120; i++)
                    {
                        h = x + (m - i * x) * (e / 12);
                        Console.WriteLine("" + (i + 1) + "还款:" + h + "当月偿还的利息为:" + (h - x) + "剩余本金为:" + (m - x * (i + 1)));

                    }

                }
                else if (b == "B")
                {
                    Console.Write("请输入贷款金额:");
                    m = Convert.ToInt32(Console.ReadLine());
                    Console.Write("请输入第几个还款月:");
                    n = Convert.ToInt32(Console.ReadLine());
                    x = m / 180;
                    y = x + (m - x) * (e / 12);
                    z = x + (m - (n - 1) * x) * (e / 12);
                    p = (180 + 1) * m * (e / 12) / 2;
                    q = p + m;
                    Console.WriteLine("您当前月份的还款金额为:" + z);
                    Console.WriteLine("您每期偿还的本金为:" + x);
                    Console.WriteLine("您的最大月供为:" + y);
                    Console.WriteLine("您应当还款的总利息为:" + p);
                    Console.WriteLine("您应当还款的总金额为:" + q);
                    for (int i = 0; i < 180; i++)
                    {
                        h = x + (m - i * x) * (e / 12);
                        Console.WriteLine("" + (i + 1) + "还款:" + h + "当月偿还的利息为:" + (h - x) + "剩余本金为:" + (m - x * (i + 1)));

                    }
                }
                else if (b == "C")
                {
                    Console.Write("请输入贷款金额:");
                    m = Convert.ToInt32(Console.ReadLine());
                    Console.Write("请输入第几个还款月:");
                    n = Convert.ToInt32(Console.ReadLine());
                    x = m / 240;
                    y = x + (m - x) * (e / 12);
                    z = x + (m - (n - 1) * x) * (e / 12);
                    p = (240 + 1) * m * (e / 12) / 2;
                    q = p + m;
                    Console.WriteLine("您当前月份的还款金额为:" + z);
                    Console.WriteLine("您每期偿还的本金为:" + x);
                    Console.WriteLine("您的最大月供为:" + y);
                    Console.WriteLine("您应当还款的总利息为:" + p);
                    Console.WriteLine("您应当还款的总金额为:" + q);
                    for (int i = 0; i < 240; i++)
                    {
                        h = x + (m - i * x) * (e / 12);
                        Console.WriteLine("" + (i + 1) + "还款:" + h + "当月偿还的利息为:" + (h - x) + "剩余本金为:" + (m - x * (i + 1)));

                    }
                }
                else
                {
                    Console.WriteLine("请您选择正确的代号!");
                }
            }
            else
            {
                Console.WriteLine("请您选择正确的代号!");
            }
            Console.Read();
        }
    }
}