#include /* main function */ int main(void) { /* variable definitions */ double balance, interest=0; int year,rate,deduction=0; /* input section */ printf("Please enter the initial bank balance in $: "); scanf("%lf", &balance); printf("Please enter the annual interest rate in %% : "); scanf("%d", &rate); printf("Year\t\tInterest\tDeduction\tBalance\n"); /* computation and output section */ for(year = 0; year <= 20; year++) { printf("%-16d%-16.2f%-16d%-16.2f\n",year,interest,deduction,balance); interest = balance * (double)rate/(double)100; if (year%2 == 0) { deduction = 2000; } else { deduction = 1500; } balance = balance + interest - deduction; } return 0; } /* end of main */