Future Value Program in C Future Value Program Write a C program that calculates
ID: 3790307 • Letter: F
Question
Future Value Program in C
Future Value Program Write a C program that calculates the future value of an investment using compound interest. The program should ask the user for the investment amount, the annual interest rate, and the period in years. Find the future value using the following formula: Future Value = Investment .amount times (1 + rate)^number-of-years Display the input data and future values along with the appropriate labels using two decimal places (see the sample output below). You program must include at least the following two functions: A function that takes three arguments (investment amount, interest, and number of years), calculates, and returns the future value. A function that output all four values to the screen as shown in the sample below. Sample input/output: Enter the investment amount, the interest, and number of years: 1000.0 10.0 10 Investment Amount: dollar I000.00 Interest: 10.00 percentage Number of years: 10.00 Future Value: dollar 2593.74Explanation / Answer
#include <stdio.h>
#include<math.h>
int main()
{
float investamount,rate,no_ofyears,futurevalue;
printf("enter invest amount,rate,no_of years");
scanf("%f%f%f",investamount,rate,no_ofyears);
futurevalue=investamount*pow(1+(rate/100),no_ofyears);
printf("investmentamount=%f",investamount);
printf("rateofinterest=%f",rate);
printf("no_ofyears=%f",no_ofyears);
printf("futurevalue=%f", futurevalve) ;
return 0;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.