How to echo or print to test the if else condition in ASP.NET
<p>i am trying to do a simple time calculating program in ASP.NET , where people enter amount and annual interest and payment per month , need to get time in months when the debt is paid of along with interest, and i want to test if the monthly payment amount is smaller than the monthly interest amount using if else condition but it doesn't seem to be working , if i put monthly payment smaller than monthly interest amount then the program hangs.</p>

<p>My code:</p>

<pre><code>   protected void btnCalculate_Click(object sender, EventArgs e)
{
    if (IsValid)
    {
        int BorrowAmount = Convert.ToInt32(txtBorrow.Text);
        double InterestRate = Convert.ToDouble(txtRate.Text);
        int MonthlyPay = Convert.ToInt32(txtMAmount.Text);

        double Rammount = BorrowAmount;

        double monthlyIntRate = InterestRate / 12;
        //LblNoMonths.Text = Convert.ToString(monthlyIntRate);
        //LblNoMonths.Text = Convert.ToString(monthlyIntRate);
        double firstmonthlyIntRateAmt = ((monthlyIntRate / 100) * Rammount);


        if (MonthlyPay &gt;= firstmonthlyIntRateAmt)
        {
            int month = 0;
            while (Rammount &gt;= MonthlyPay)
            {
                month++;
                double monthlyIntRateAmt = ((monthlyIntRate / 100) * Rammount);

                Rammount = Rammount - (MonthlyPay - monthlyIntRateAmt);

            }
            LblNoMonths.Text = Convert.ToString(month);
        }
        else
        {

            LblNoMonths.Text ="Monthly payment is less than the monthly interest rate!!";

        }



    }
}
</code></pre>

<p>The code inside else condition seem to have no effect</p>

<p>LblNoMonths.Text =@"Monthly payment is less than the monthly interest rate!!";</p>

<p>am i doing anything wrong , please any help would be greatly appreciated and Thanking you all in advance</p>
