Aspire Systems interview question

I was told to write the code logic.