我正在尝试计算在给定周期数后投资回报为正的总概率。自从我做概率以来已经有一段时间了,所以我不太记得它。我做对了吗?我得到的数字相当低。
double totalProbPos = 1;
for (int i = 0; i < maxPeriods; i++) {
totalProbPos *= (probPos / 100);
}
totalProbPos = round(totalProbPos);
System.out.println("\nThe probability that your investment will return positive after " + maxPeriods + " periods is: \n " + totalProbPos + "%.");
其中:maxPeriods, probPos
由用户给出。