我需要两个列表作为输出,其中一个是索引列表,另一个是相应的值,直到条件满足为止.
//initializing the first value of TotalDebts
double TotalDebts = 30000;
for (int i = 0; i < 250; i++)
{
if (TotalDebts > 0)
{
double DebtsLessIncome = Convert.ToDouble(TotalDebts - 1000);
double InterestCharged = Convert.ToDouble((DebtsLessIncome * 5) / 100);
double InterestDebt = Convert.ToDouble(DebtsLessIncome + InterestCharged);
double InterestDebtMLE = Convert.ToDouble(InterestDebt + 500);
double TotalDebts = Convert.ToDouble(InterestDebtMLE);
//how to add TotalDebts in list or dictionary from each loop as index 0,1,2 and so on
List<double> AllDebits = new List<double>();
AllDebits.Add(TotalDebts);
// …Run Code Online (Sandbox Code Playgroud) c# ×1