Code:

Click here to run