Dec 29, 2017 at 7:13pm
You haven't shown the declaration of P, Y or S.
If P is an int
, you're going to be doing integer division at line 2.
Dec 29, 2017 at 7:13pm
What is the type of P, Y, S?
Edit:
(1 - (1 + (P/100/12))^(-Y*12)) ||: (P/100/12) = A
(1 - (1 + A)^(-Y*12)) ||: (-Y*12) = B
(1 - (1 + A)^B) ||: (1 + A) = C
(1 - C^B)
(1 - std::pow( C, B )) |
but you have:
Last edited on Dec 29, 2017 at 7:21pm
Dec 29, 2017 at 7:16pm
P, Y, S are all double
1 2 3 4 5 6 7
|
#include <iostream>
#include <cmath>
int main()
{
double S, P, Y;
}
|
I also tried with float, but with that, answer changed to 0.
Last edited on Dec 29, 2017 at 7:16pm