67 060
Assignments Done
99,3%
Successfully Done
In November 2018

Answer to Question #23618 in C++ for Yanna

Question #23618
how to program compound interest using only p,r,t,and n(no.of times compounded each year?NO use of math.h just stdio.h.
Expert's answer
#include <stdio.h>int main(){
floatp = 0, r = 0;
intt = 0, n = 0;
printf("Enterprincipal amount (initial investment): ");
scanf("%f",&p);
printf("Enterannual nominal interest rate (as a decimal, not in percentage): ");
scanf("%f",&r);
printf("Enternumber of years: ");
scanf("%d",&t);
printf("Enternumber of times the interest is compounded per year: ");
scanf("%d",&n);
for(inti = 0; i < t*n; i++){
p+= p*r/n;
}
printf("
Thebalance after %d year(s): %f
", t, p);
return0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions