Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Future Value Program in C - Please make sure that it will compile. Thanks Future

ID: 3791048 • Letter: F

Question

Future Value Program in C - Please make sure that it will compile. Thanks

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 x (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: $1000,00 Interest: 10.00% Number of years: 10.00 Future Value: $2593, 74

Explanation / Answer

#include <stdio.h>
#include <math.h>
void main( )
{
float I,r, n, s,f;
clrscr();
printf("P1ease enter a value for the Investment(I): " ) ;
scanf ( "%f", &p);
printf("P1ease enter a value for the interestrate ( r ) : " ) ;
scanf ("%f" , & r );
printf("P1ease enter a value for the number of years (n) : " ) ;
scanf ( " % f ", &n) ;
printf ( "Investment amount (I)is : %.2f ", I);
printf ( "Interest rate(r)is : %.2f% ", r);
printf ( "Number of years (n)is : %.2f ", n);
s=r/100;
f = p * pow((1 + s) , n ) ;
printf ( " The final value (F) is : %.2f ", f ) ;
getch();
}