-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbank.c
More file actions
25 lines (21 loc) · 694 Bytes
/
bank.c
File metadata and controls
25 lines (21 loc) · 694 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <stdio.h>
int main(){
double deposit,initialDeposit,target;
double initialRate = 10;
double YearDeposit;
double RateatYear;
int year = 0;
printf("Enter the initial Deposit: ");
scanf("%lf",&initialDeposit);
printf("Enter the target amount: ");
scanf("%lf", &target);
deposit = initialDeposit;
do{
year++;
RateatYear = (deposit*initialRate)/100.0;
YearDeposit = deposit;
deposit += RateatYear;
printf("\n%d $%3.2f %3.2f\n", year, (double) YearDeposit, (double)RateatYear);
}while(deposit<target);
printf("Deposit exceeds 2000 at the end of the year %d ", year);
}