hi ..
i'm having a trouble trying to make this code works !
actually the question says:
you have to ask the user for three values : positive double value for deposit, positive double value for interest rate , positive int for the number of years. and the program should compute the deposit in the savings account including interest after specified time of period with interest assessed ( every month) and added back to the deposit.so i have to compute the final deposit value ( which i declared as y )
so here is what i came up with :
i tried ( 1200.00 as deposit , 0.08 as interest rate , 2 years) the output still 00.0 .. and i'm confused do i need to calculate the formula for 12 months ? please help me .. i appreciate it .. thanks !!Code:#include<stdio.h> int main(void) { double d ; // deposit double i ; //interest rate int x; // years double y=0.00; //final deposit value computed by the program printf("Enter the deposit in positive double value please:\n"); scanf("%f" , &d); printf("Enter the interest rate in positive double value please:\n"); scanf("%f" , &i); printf("Enter the time period in years:\n"); scanf("%d" , &x); y= d*(1+(i*x)); printf("After %d of years , the deposit in the savings account is now %1.2f \n" , x , y); return 0; }