6.1 Add seconds, minutes and hours of two video clips

Scratch solution

View solution

This is just one of many possible solutions:

whenclickedsetsecs1to0setmins1to0sethours1to0setsecs2to0setmins2to0sethours2to0settotal secsto0settotal minsto0settotal hoursto0askEnter the number of hours for the first clip: andwaitsethours1toansweraskEnter the number of minutes for the first clip: andwaitsetmins1toansweraskEnter the number of seconds for the first clip: andwaitsetsecs1toansweraskEnter the number of hours for the second clip: andwaitsethours2toansweraskEnter the number of minutes for the second clip: andwaitsetmins2toansweraskEnter the number of seconds for the second clip: andwaitsetsecs2toanswersettotal secstosecs1+secs2settotal minstomins1+mins2settotal hourstohours1+hours2iftotalsecs>59thensettotal secstototalsecsmod60changetotal minsby1iftotalmins>59thensettotal minstototalminsmod60changetotal hoursby1

Back to programming challenge