Skip to content

Instantly share code, notes, and snippets.

@antonio-abrantes
Created June 27, 2016 23:11
Show Gist options
  • Save antonio-abrantes/5b8feb44e7c0c1636d882c138e7b310c to your computer and use it in GitHub Desktop.
Save antonio-abrantes/5b8feb44e7c0c1636d882c138e7b310c to your computer and use it in GitHub Desktop.
Uri 2033 - (WA 70%)
/* Juros Sobre o Empréstimo - Problemas nº 2033 - Matematica
https://www.urionlinejudge.com.br/judge/pt/problems/view/2033
Problema com Wrong answer (70%) */
#include <stdio.h>
#include <math.h>
int main()
{
int tempo;
double capital, juroSimples, juroCompos, diferenca, expo, 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;
diferenca = juroCompos - juroSimples;
printf("DIFEREN%cA DE VALOR = %.2lf\n", 128, diferenca);
printf("JUROS SIMPLES = %.2lf\n", juroSimples);
printf("JUROS COMPOSTO = %.2lf\n\n", juroCompos);
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment