Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- cout.setf(ios::fixed);
- cout.setf(ios::showpoint);
- cout.precision(2);
- double loan;
- double interest_rate;
- double intr2=0;
- int payment = 0;
- int count = 0;
- cout << "===========================================\n";
- cout << "Input the cost of the item in $ (the debt): ";
- cin >> loan;
- if (loan >=2501)
- {
- cout << "Invalid input" << endl;
- cout << "Please type another input less or equal to 2500$: ";
- cin >> loan;
- }
- if (loan <=1000)
- do
- {
- count ++;
- interest_rate=loan*0.015;
- loan=loan-50+interest_rate;
- cout << "Month " << count << " - ";
- cout << " Interest paid: " << interest_rate << " - ";
- cout << " Remaining debt: " << loan << endl;
- }
- while (loan>0);
- if (loan <0)
- {
- loan=0;
- }
- {
- if (loan <= 2500 && loan >=1001);
- {
- do
- {
- count++;
- intr2=loan*0.02;
- loan=loan-50+intr2;
- cout << "Month " << count << " - "
- << "Interest paid: " << intr2 << " - "
- << " Remaining debt: " << loan << endl;
- }
- while (loan>0);
- if (loan <0)
- {
- loan=0;
- }
- }
- }
- return 0;
- }
Add Comment
Please, Sign In to add comment