if possible also explain the code how it works. THANK YOU for helping ! The required combination is as follow: Case 1: If all pbs are released all leds off Case 2: If pb1 is pressed only the green led is on Case 3: If pb2 is pressed only the red led is on Case 4: If pb3 is pressed all leds are on Note 1: there is no "else" case as for 2 inputs only 4 cases are possible. Note 2: the remaining pins of PORTC are used for other purpose .