simply write code each questions attached file

Simply write code for each questions on the attached file.