Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am calculating interest. Can someone help me get these results: 2 1500 .04 1624.93 and 10 1500 .04 2237.74 the first number being years

I am calculating interest. Can someone help me get these results:

2 1500 .04 1624.93

and

10 1500 .04 2237.74

the first number being years followed by principle and interest.

Here is my code

#variables(p=principle,r=interest rate,t=time in years) p=int(sys.argv[1]) r=int(sys.argv[2]) t=float(sys.argv[3])

#function for interest calculation def compoundInterest(p, r, t): Amount = p * (pow((1 + r / 100), t)) #CI=compound interest. CI = Amount - p #prints total amount of interest stdio.writeln(CI)

#Function call compoundInterest(p,r,t)

This produces 0.23457427614444004

instead of 1624.93

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_step_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions