double limit=0.05, mult=6.9, factor =0.45, total=1; int count=0; while (mult>limit) { mult=mult*factor; total=total+mult; count++; } g.drawString("The total is " + total,20,30); g.drawString("No of iterations is " + count,20,50);