Click here to Skip to main content
15,901,283 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
See more:
i am doing c# loan application.
the loan amount is=10000.
the customer pay the emi by daily =100.
but the customer cannot pay the amount for 10 days.
how to show the late pay amount and late pay interest.
please give the solution friends............
thanks advance.
i post my late pay amount code below.

What I have tried:

C#
DateTime fromDate = Convert.ToDateTime(lblfdate.Text);//from date already inserted in db
DateTime toDate = Convert.ToDateTime(txtdate.Text);//to date already inserted in db
//diff b/w from date and to date is 100 days
int temp;
            
int cbal = 0;
            
for (DateTime date = fromDate; date < toDate; date = date.AddDays(1))
{
    temp = (Convert.ToInt32(txtnamt.Text) / Convert.ToInt32(lbldays.Text));
    cbal=cbal+temp;   
}
txtcamt.Text = Convert.ToString(cbal);
Posted
Updated 13-Feb-18 5:38am
v2
Comments
Richard MacCutchan 13-Feb-18 4:24am    
This is just a question of mathematics. For each day that the customer does not pay you need to add 100 to the latePayment total.
Pasupathy Msc 13-Feb-18 6:07am    
but please give me an example
Richard MacCutchan 13-Feb-18 7:51am    
Example of what? You have two DateTime vaues, so you can easily get the number of days difference, by using the TimeSpan Structure (System)[^]. And from that you can calculate how much is owed.
Pasupathy Msc 13-Feb-18 7:56am    
i cant able to understand sir,give me a real time example

1 solution

As with most problems, use a pencil and paper and work out the solution.
Detail everything you are doing.
Is your code doing the same thing?
Are you getting the same result?

If there is still a problem, run the code in debug mode and check the results as you go.

Until you understand HOW to calculate the results, your code will never work.. and you are asking someone to write the code for you... you've been given suggestions already.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900