S10 Health interview question

They gave 2 problems to give code for the output