大家安安
突然发现有人关注
但是~
前面的坑还没有补好
後面很难写
不过这篇我预计会写"算利息"因为"人生第一次忘记缴钱"
还好只过了一天..没被罚钱
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace BA993265_2
{
class Program
{
static void Main(string[] args)
{
{
string[] monthStr = new string[] { "一", "二", "三", "四", "五" };
int month = 0;
double loan = 0.0, pay = 0.0, total = 0.0;
double interest = 0.0;//利息
double interestTotal = 0.0;
double tax = 0.18;//年利率
double tot_interest = 0.0;//利息总额
while (true)
{
Console.Write("\n请输入您向银行的借款金额:");
loan = Convert.ToDouble(Console.ReadLine());//将输入的资料转成整数
total = loan;
Console.Write("请输入您每月还款的金额");
pay = Convert.ToDouble(Console.ReadLine());//将输入的资料转整数
if (pay > loan)
{
Console.Write("\n每月还款不能大於 借款!\n");
continue;
}
break;
}
while (loan > 0)
{
interest = (loan * tax) / 12;//每月应还的利息
if ( loan - pay > 0 )
{
loan -= pay;
loan += interest;
}
month++;
Console.WriteLine("第{0}个月底,利息等於{1:C},尚欠{2:C}", monthStr[month-1], interest, loan);
if (loan - pay < 0)
{
interest = loan * tax / 12;
loan += interest;
month++;
Console.WriteLine("第{0}个月底,利息等於{1:C},最後还款{2:C}", monthStr[month - 1], interest, loan);
loan = 0;
}
interestTotal += interest;
}
Console.WriteLine("您借{0},还了{1}个月,利息共还{2:C}.\n\n", total, month, interestTotal);
Console.Read();
}
}
DEAR ALL 我们明天见
<<: [Day 28] banana in a box!关於双向系结功能的语法糖
##API规划 先准备这次消费串接的API,主要需要三支API 订单建置API 目的: 由网站点选缴...
Toast功能是可以在萤幕的下方显示一段即时的讯息文字 但文字会在几秒後消失 在Toast跳出来时,...
今天要来练习LED的流动练习 参考来源-六指渊:https://www.sixvfx.com/exp...
今天在 TLPI 看到这个写法,於是来纪录一下。 大纲 什麽情况会让一个 function 绝对不会...
我今天要来教大家Python的while回圈,前天有教过for回圈,都是能让程序重复跑的语法,但是功...