Created
June 28, 2016 01:10
-
-
Save antonio-abrantes/51c80da9676518ede3172e1e483c6e31 to your computer and use it in GitHub Desktop.
Uri 2033 - (Accepted)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <math.h> | |
int main() | |
{ | |
int tempo; | |
double capital, juroSimples, juroCompos, diferenca, expo; | |
double txJuros; | |
while(scanf("%lf", &capital) != EOF) | |
{ | |
scanf("%lf", &txJuros); | |
scanf("%d", &tempo); | |
juroSimples = capital * txJuros * tempo; | |
expo = pow(1 + txJuros, tempo); | |
juroCompos = (capital * expo) - capital; | |
if(juroSimples >= juroCompos) | |
diferenca = juroSimples - juroCompos; | |
else | |
diferenca = juroCompos - juroSimples; | |
printf("DIFERENCA DE VALOR = %.2lf\n", diferenca); | |
printf("JUROS SIMPLES = %.2lf\n", juroSimples); | |
printf("JUROS COMPOSTO = %.2lf\n", juroCompos); | |
} | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment