These are the relevant parts of the code:
loopcount = 0;
...
if TotalEnrolledNew < 10000;
...
...
...
loopcount = loopcount + 1
else
...
...
...
end
As you can see all loops are totally irrelevant to your loopcount variable: it is not incremented in any loop because it is not inside any loop.
It is not clear what you expect loopcount to do, or why you think it has anything to do with loops.
"The idea is quite blatant, to follow the first set of rules until TotalEnrollmentNew is greater than 10000, then follow the new set of rules using TotalEnrolledNew in its first iteration."
You don't change TotalEnrolledNew inside any loop, so it is not clear how this description corresponds to your code. If TotalEnrollmentNew should be changing "until" some condition then you need to be defining/updating its value inside some loop of some kind, perhaps something like this:
TotalEnrollmentNew = ...
...
while TotalEnrolledNew < 10000;
...
TotalEnrollmentNew = ...
end
...
...
while ...
...
end
Best Answer