-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonthly_balance.c
More file actions
26 lines (17 loc) · 881 Bytes
/
monthly_balance.c
File metadata and controls
26 lines (17 loc) · 881 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
26
#include <stdio.h>
int main(void)
{
float balance = 0.0f, interest_rate = 0.0f, monthly_payment = 0.0f;
printf("Enter amount of loan: ");
scanf("%f", &balance);
printf("Enter interest rate: ");
scanf("%f", &interest_rate);
printf("Enter montlhy payment: ");
scanf("%f", &monthly_payment);
printf("Balance remaining after first payment: $%.2f\n", (balance - monthly_payment) + (balance * (interest_rate / 100 / 12)));
balance = (balance - monthly_payment) + (balance * (interest_rate / 100 / 12));
printf("Balance remaining after second payment: $%.2f\n", (balance - monthly_payment) + (balance * (interest_rate / 100 / 12)));
balance = (balance - monthly_payment) + (balance * (interest_rate / 100 / 12));
printf("Balance remaining after third payment: $%.2f\n", (balance - monthly_payment) + (balance * (interest_rate / 100 / 12)));
return 0;
}