Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- float balance = 1000;
- int totalPayments = 0;
- int monthly;
- int monthNum = 0;
- print "Enter the amount to be paid monthly: ";
- get input for monthly
- while(balance >= monthly) {
- totalPayments += monthly;
- ++monthNum;
- balance = (balance - monthly) + (balance * 0.015);
- print "Months: " + monthNum + "Balance: " + balance + "total payments: " + totalPayments;
- }
- print "Remaining balance can be paid with the exact amount of " + balance;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement