# Mixed Up Code Practice¶

The program below should print out the even numbers between 20 and 40, inclusive, but the code is mixed up and contains extra blocks. Put the necessary blocks in the correct order.

The program below should count down from 100 to 0 in decrements of 10 but the code is mixed up and contains extra blocks. Put the necessary blocks in the correct order.

The program below should find the sum of the first 10 natural numbers, but the code is mixed up and contains extra blocks. Put the necessary blocks in the correct order.

Let’s write the code for the repeatHello function. repeatHello should be a void function that takes no arguments and uses a while loop to print out “hello” three times.

Now let’s generalize the repeatHello function so that it repeats a given string three times. Let’s write the code for the repeatString function, which takes input as a parameter and uses a while loop to print out the string three times.

We can further generalize repeatString so that it repeats a given string a given number of times. Let’s write the code for the new repeatString function, which takes input and x as parameters and uses a while loop to print out the string x number of times.

On the last day of every year, we count down the seconds before the new year arrives. Write the function newYearCountdown, which prints out a countdown from 10 and then prints out “Happy New Year!”.

Help Goku reach power levels of over 9000! Write the function powerUp which takes powerLevel as a parameter. powerUp checks to see if powerLevel is over 9000. If it isn’t, it repeatedly prints “More power!” and increments powerLevel by 1000 until powerLevel is over 9000. Then powerUp prints “It’s over 9000!”. Put the necessary blocks in the correct order.

Write the function summation which takes two parameters, start and end. summation adds all the integers from start to end, inclusive, together and returns the sum. Put the necessary blocks in the correct order.

Write the function reverseNumber which takes num as a parameter and returns num but with its digits reversed. For example, reverseNumber (1324) returns 4231. Put the necessary blocks in the correct order, with reverse declared first, then temp, and lastly remainder.