Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace Classwork04
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click_1(object sender, EventArgs e)
- {
- // 表示還清欠款需求月數
- int month = 0;
- // 表示已還清之金額
- int backCoins = 0;
- // 表示未還清之金額
- int unGive = 10000;
- while (unGive >= 2000)
- {
- unGive = (int)Math.Ceiling(unGive * 1.015) - 2000;
- backCoins += 2000;
- month++;
- }
- label1.Text = "還清月數:" + (++month).ToString();
- label2.Text = "總款金額:" + (backCoins + unGive).ToString();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment