Solve as per question paper
Inspiration taken from ScratchEdTeam's work.. http://scratch.mit.edu/projects/2042736/