adding code & output

adding code & output