Arduino sketch from truth table

Yes this is how I imagined it to do but I will write the same in C with if else statements!