c# - Trying to loop and multiply percentage per count line -


i can't figure out how daily increase value , multiply each new count line. i'm pretty sure error in math , trying setup calculations output listbox.

if (numdays >= 0) {      // continue process input. /      // following loop calculates final distance traveled. /     while (count <= numdays)     {         // calculate organism population. /         avgincreasedecimal = avgincreaseinputvalue / 100;         percentagecalc = (organismsinputvalue * avgincreasedecimal);         nextpopulationcalc = organismsinputvalue + (organismsinputvalue * avgincreasedecimal);          // display orgamism population each day. /         organismscalclistbox.items.add("after day " + count + ", organism population approx. " + nextpopulationcalc.tostring("n6"));          // add 1 loop counter. /         count = count + 1;          // return focus organisms textbox. /         organismsinputtextbox.focus();     } } 

i've studied other examples online... still don't how multiply 30% , add each new count line.

given avgincreadeinputvalue value 1-100 (percent) , oh , luck rest of school exercise know asking others bit of cheating ;)

var   avgincreasedecimal = 1 + (avgincreaseinputvalue / 100);  var nextpopulationcalc = organismsinputvalue;  // following loop calculates final distance traveled. / while (count <= numdays) {     // calculate organism population. /     nextpopulationcalc = nextpopulationcalc * avgincreasedecimal;      // display orgamism population each day. /     organismscalclistbox.items.add("after day " + count + ", organism population approx. " + nextpopulationcalc.tostring("n6"));      // add 1 loop counter. /     count = count + 1; } 

Comments