For the 7th coding challenge, we will make a program that contains a for loop and 2 int variables. The program’s purpose will be to act as a countdown timer for NASA. We want the countdown to start at 10 and finish at 1. Feel free to name the variables on your own. However, be aware that for loops generally use
int i as its variable type and name. When you are done, your program should print something out like the following:
Also, know that the first and last statements in the output do not have to be within the for loop. In fact, it is best if you leave it out of the loop. As always, if you can’t figure it out, feel free to scroll down. Good luck!
for loops wordpress won’t leave spaces
See how we used the decrement operator to take 1 away from
int i every loop? Awesome job and see you next chapter!
Leave a Reply