Apparently, you haven't bothered to look at the documentation for the delay function.
The code however doesnt seem to be working.
Maybe it's just taking a short vacation.
On the other hand, you could try explaining what it does do, what it does not do, and how what it does differs from what you want it to do.
There are too many things you haven't said for us to be able to help you. For instance, what is connected to pins 22 and 24? Do you KNOW that you can read consistent data from those pins? That is, are you certain that the results of digitalRead on those pins is consistent with the input you are providing?