Im trying to get a 3 button password sequence working
Without programming everything out, use something like this:


Initialization:


Create a (global) variable of string ("12331") which is the code
Create a (global) variable of int that shows the number of correct numbers so far (initially 0)

In the while loop:


Check which button is pressed
If it is the correct button
increase the int variable
If that variable is 5 (meaning all numbers ok), light up the LED
Delay
Make the variable 0 again 
Clear the LED
If the wrong button is pressed
If it is equal to the first value ('1')


Set the variable to 1 (since the wrong number is the first correct number)

Else


Set the variable to 0