Interest (1) P85370


Statement
 

pdf   zip

thehtml

Given an initial capital c in euros, an annual interest rate i (expressed in %), a time t in years and an indication whether the interest is simple or compound, determine the amount of euros the initial capital is transformed into.

Input

The input consists of two strictly positive real numbers c and i, followed by a strictly positive integer t, followed by either the word “simple” or the word “compound”.

Output

Write the final capital with 4 decimal places.

Observation

If you program in C++, use the double data type and put these two lines at the beginning of your main():

cout.setf(ios::fixed); cout.precision(4);
Public test cases
  • Input

    1000 3 2 simple
    

    Output

    1060.0000
    
  • Input

    1000 3 2 compound
    

    Output

    1060.9000
    
  • Input

    1234.5 5.1 22 compound
    

    Output

    3687.6598
    
  • Information
    Author
    Language
    English
    Translator
    Gabriel Valiente
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Python