Saturday, February 11, 2017

Uri 2033-Interest on Loan

#include<bits/stdc++.h>




using namespace std;

int main()
{
    //freopen("in.txt","r",stdin);
    int n,i,m;
    double m_a,i_r;
    while( cin >> m_a >> i_r >> m){
        double s,c,d;
        //simple interest
        s = (m_a*i_r)*m;
        //Compound interest
        c =  m_a* (powl((1+i_r),m)) - m_a;
        //interest difference
        d = abs(s-c);
        cout << "DIFERENCA DE VALOR = " << fixed << setprecision(2) << d << endl;
        cout << "JUROS SIMPLES = " << fixed << setprecision(2) << s << endl;
        cout << "JUROS COMPOSTO = " << fixed << setprecision(2) << c << endl;
    }

    return 0;
}

No comments: