Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7187109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T18:46:25+00:00 2026-05-28T18:46:25+00:00

I am trying to make a simple time-calculating program in ASP.NET where people enter

  • 0

I am trying to make a simple time-calculating program in ASP.NET where people enter an amount, an annual interest, and a payment per month.

I need to get the time in months to 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 an if else condition but it doesn’t seem to be working. If I provide a monthly payment smaller than the monthly interest amount, then the program hangs.

My 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 >= firstmonthlyIntRateAmt)
        {
            int month = 0;
            while (Rammount >= 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!!";

        }
        

       
    }
}

The code inside else condition seems to have no effect:

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

Am I doing anything wrong?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T18:46:26+00:00Added an answer on May 28, 2026 at 6:46 pm

    just press F9 on If Statement (Break Point) and start debugging. to go step forward just use F10 to follow code execution flow! 😉 You can also use VS watch window to see exact amount inside each value … nothing else would help you!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to make a simple program to convert time given in seconds
I'm trying to make a simple blackjack program. Sadly, I'm having problems right off
I'm trying to make a simple program that continually displays and updates a label
I'm trying to make a very simple iphone app that displays the real-time camera
I am currently trying to make a very simple C program for school that
I am a beginner to C#. I am trying to make a simple program
I am trying to make a simple TCP client and host chat program in
I'm trying to make a simple C# web server that, at this stage, you
I'm trying to make some simple XML with Java and org.w3c.dom, but I got
I'm trying to make a simple drawing app in c++, but i'm having trouble

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.