cousera课程 Introduction to Programming with MATLAB 范德堡大学 作业1

We borrowed $1000 at a 10% annual interest rate. If we did not make a payment for two years, and assuming there is no penalty for non-payment, how much do we owe now? Assign the result to a variable called debt.

代码:

principal = 1000;

rate_of_interest = 10;

n = 2;

time_period = n-1;

simple_interest = (principal * rate_of_interest * time_period)/100

amount = principal + simple_interest

principal = amount;

simple_interest = (principal * rate_of_interest * time_period)/100

debt = principal + simple_interest
发布了57 篇原创文章 · 获赞 59 · 访问量 9694

猜你喜欢

转载自blog.csdn.net/AI_LINNGLONG/article/details/105193273