class Test
{
static void Main(string[] args)
{
int[] m = { 100, 50, 20, 10, 5, 1 };
string ok="";
do
{
System.Console.Write("请输入支付的金额:");
int money = int.Parse(System.Console.ReadLine());
int count = 0;
int result = money;
for (int i = 0; i < m.Length; i++)
{
count = count + result / m[i];
result = result % m[i];
}
System.Console.WriteLine("至少要{0}张钞票!", count);
System.Console.Write("是否继续?(yes/no):");
ok = System.Console.ReadLine();
}
while (ok == "yes");
}
}
计算统计钞票的张数
最新推荐文章于 2023-10-09 16:19:21 发布