Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Aug 12th, 2012  |  syntax: None  |  size: 0.46 KB  |  hits: 8  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
This paste has a previous version, view the difference. Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include<iostream>
  2. using namespace std;
  3. #include<math.h>
  4. int main()
  5. {
  6.    float si,c,a,p,r,ci;
  7.   float t;
  8.     cout << " principal rate time " << endl;
  9.     cin>>p >> r >> t;
  10.     if(p>0 && t>0)
  11. {
  12.     si=(p*r*t)/100;
  13.     a=p*pow((1.0+r/100.0), t);
  14.     c=a-p;
  15.  ci = floor(c*100)/100;
  16.     cout << "The simple interest is " << si << endl;
  17.     cout << "The compound interest is " << ci << endl;
  18.    
  19. }
  20. else {
  21. cout<< "invalid input" << endl;
  22. }
  23. return 0;
  24. }