This quiz was about functions, they were many possible answers but it was expected that we use a loop or a recursion:
The first one was: Create a program with the following function. Write a function called superpower that has receives two parameters (ints) and returns an integer which is first parameter raised to the power of the second, which is to say it returns a b .
The second one: Create a program with the following function. Write a function called stars that has one parameter of type integer and PRINTS that many stars on a single line, so if we call the function with stars(5), the function will print like this: *****
Well I had to confess that this was a quiz that we had weeks ago, but at that time I didn´t know how to do it cz I didn´t know how to make a function and was not really sure how to do a Do-While.
Now after investigating for making my WSQ’s and learning about how to make functions and Do-While, I was ready for this.
For making the first one I decided to use a Do-While. The first number would be multipling by itself until the “contador” (who was adding one each time the program repeated) was the same value than the second number, who was the “raised to the ___ “.
During making this program the first time I run it I noticed that I didn’t ask the user for the two values … JA-JA. (Not funny at all … ), the second time I run it… it did not work cz it was printing again the first value… and the third one (yes…you know what they say
Continue reading “Quiz 2” →