Quiz 04

--Originally published at Ken's Disciple 01

Picture by Stokpic Stokpic

Hello everyone, on this week we had to do our Quiz 04, which was about minimum and squares. We had to ask a user to give us three numbers and we would give them the minimum of those three numbers and the sum of the squares of the numbers. We also had to do this program with the functions minimumThree and sumSquares.

Note: I’m actually learning how to give format to my program, soon I’ll be doing it easier to read and also I’ll be adding comments.

Everything in this program is the same, the only thing to highlight here is that we have to make sure that our functions return what we want them to return. In minimumThree I told the program to return the minimum of the numbers, which I did with the function min: this function returns the minimum of two numbers thats why I have  return min(x,min(y,z)); (returns the minimum of two numbers and then returns the minimum of that number plus the third one). In sumSquares its easy cause you ask the program exactly the operation you want it to do, simply as: return ((x*x)+(y*y)+(z*z));

Here are some pictures of the program, a blog of “Programming the city” that helped me, and my program as always on GitHub.

Captura de pantalla 2017-02-03 a la(s) 11.09.49.png

Captura de pantalla 2017-02-03 a la(s) 11.10.06.png

Captura de pantalla 2017-02-03 a la(s) 11.10.18.png

 

L.out