Max of 3 values

--Originally published at Carolina's Blog Site

Challenge: create a program that takes three numbers as arguments and returns the largest of them.

At first I got all confused and started making unnecessary loops. It was very frustrating.

confused joey joey tribbiani matt leblanc im so confused

Then Ken reminded me that when creating a program, first you must think about it logically, forget about the sintax: what does your program need to do? how would a human do that? how would you explain it in pen and paper?

That made things a lot easier. IMPORTANT ADVICE TO REMEMBER.

Image result for sudden realization meme

So then, basically what I did was assume that the first integer given by the user was the biggest one, created a variable for it, and then I compared it with the other values and changed it if necessary.

Here’s my code, hope it’s helpful: https://github.com/cpvp20/max_of_three

 

sources:

http://giphy.com/gifs/money-help-wwyb-vsZF2hC9cH0Mo

http://knowyourmeme.com/memes/sudden-clarity-clarence