5.1 Add number of months to a given month

Scratch solution

View solution

This is just one of many possible solutions:

whenclickedsetnew monthto0askType in a number between 1 and 12 for a month of the year:andwaitsetoriginal monthtoansweraskEnter the number of months to add to the month:andwaitsetmonths to addtoanswersetnew monthtooriginalmonth+monthstoaddmod12ifnewmonth=0thensayjoinjoinmonthstoaddjoin months after itemoriginalmonthofmonths is December. elsesayjoinjoinjoinjoinmonthstoaddjoin months after itemoriginalmonthofmonths is itemnewmonthofmonths.

Back to programming challenge