Folks,
I've got this code below that creates an interest table with the interest compounded annually. I want to convert it to compound the interest on a monthly basis instead. Can anyone help and give advice as to what I need to focus on changing? Thanks!
Code:/*Prints a table of compound interest */ #include <stdio.h> #define NUM_RATES (sizeof(value) / sizeof(value[0])) #define INITIAL_BALANCE 100.00 main() { int i, low_rate, num_years, year; float value [5]; printf("Enter interest rate: "); scanf("%d", &low_rate); printf("Enter number of years: "); scanf("%d", &num_years); printf("\nYears"); for (i=0; i<NUM_RATES; i++) { printf("%6d%%", low_rate+i); value[i] = INITIAL_BALANCE; } printf("\n"); for (year = 1; year <= num_years; year++) { printf("%3d ", year); for (i=0; i<NUM_RATES; i++) { value[i] += (low_rate+i) / 100.00 * value[i]; printf("%7.2f", value[i]); } printf("\n"); } return 0; }



LinkBack URL
About LinkBacks



