heimsventus

calculating interest over 5 years interest code 25jan17

Jan 25th, 2017
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. // ConsoleApplication3.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "stdafx.h"
  6. #include <iostream>
  7. #include <string>
  8. #include <cmath>
  9. using namespace std;
  10. int main()
  11. {
  12.  
  13.     double loanamount = 100;
  14.    
  15.     double interestrate = .05;
  16.     double paybackamount = 0;
  17.     double length;
  18.     int i;
  19.     for (int i = 0; i < 5; i++)
  20.     {
  21.  
  22.         paybackamount += (loanamount*interestrate);
  23.     }
  24.     paybackamount += loanamount;
  25.         cout << "you owe your friend " << paybackamount << endl;
  26.  
  27.  
  28. system("pause");
  29.  
  30. return 0;
  31.  
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment