[Solved] Decrease an INT by 10% each round in C


The three statements after for are the initialization, the test condition for continuing the loop, and the statement repeated on each loop. We want to initialize delayTime to 50,000. We want to continue if delayTime is greater than or equal to 100. And we want to multiply it by 0.9 each loop (preferably without doing any floating point math). So:

for (delayTime = 50000;
    delayTime >= 100;
    delayTime -= delayTime / 10)
{

    light1(on);
    delay(delayTime);
    light1(off);
    delay(delayTime);
    light2(on);
    delay(delayTime);
    light2(off);
    delay(delayTime);
}

0

solved Decrease an INT by 10% each round in C