sorry that was a bit too much of a rush. you have to update the b at each stage as in the following. #include <admodel.h> main() { int n=25; double Binit=1000; double C=500; double B=Binit; for (int i=1;i<=n;i++) { B=B/(1.0+C/(n*B)); } cout << Binit-B << " " << C << endl; }