Problem A13

Implemented if logical form