PLEASE ANSWER IMMEDIATELY!! THANK YOU Write a C++ program that allows a user to
ID: 646005 • Letter: P
Question
PLEASE ANSWER IMMEDIATELY!! THANK YOU
Write a C++ program that allows a user to enter an amount of money to be placed into savings each year, the number of years the saving will take place at the interest rate (as a decimal) that the savings plan gives. use a function named calculate() to compute the final amount of money in the savings account if the principal is compounded annually. finally main() should output te amount of the money in the saving account.
Example:
please input amount of money to be deposited each year 100
please input the number of years to run this program for 3
please input the interest rate you are getting at this bank .01
the amount of money in your savings account now is $306.04
Explanation / Answer
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
/* variable declaration part */
int p,t;
float r,amt,ci;
clrscr();
/* Reading Part */
printf("Enter Principal Amount -> ");
scanf("%d",&p);
printf("Enter Time -> ");
scanf("%d",&t);
printf("Enter Rate of interest-> ");
scanf("%f",&r);
/* Processing Part */
amt= p*pow((1+r/100),t);
ci = amt-p;
/* Output Part */
printf(" Simple interest :-> %7.2f ",ci);
printf("Total amount :-> %7.2f ",amt);
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.