Holey_yan

20160408_CSharp_Classwork04

Apr 8th, 2016
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.99 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9.  
  10. namespace Classwork04
  11. {
  12.     public partial class Form1 : Form
  13.     {
  14.         public Form1()
  15.         {
  16.             InitializeComponent();
  17.         }
  18.  
  19.         private void button1_Click_1(object sender, EventArgs e)
  20.         {
  21.             // 表示還清欠款需求月數
  22.             int month = 0;
  23.             // 表示已還清之金額
  24.             int backCoins = 0;
  25.             // 表示未還清之金額
  26.             int unGive = 10000;
  27.  
  28.             while (unGive >= 2000)
  29.             {
  30.                 unGive = (int)Math.Ceiling(unGive * 1.015) - 2000;
  31.                 backCoins += 2000;
  32.                 month++;
  33.             }
  34.  
  35.             label1.Text = "還清月數:" + (++month).ToString();
  36.             label2.Text = "總款金額:" + (backCoins + unGive).ToString();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment