Solution of arithmetic quiz exercise