The 'zero division error' occurs because of this line
Seconds %= Minutes
In order to compute the reminder, a division is performed, if
Minutes
is zero the troubles are going to come.
However, as pointed out by
Sandeep your code is (thoroughly) incorrect, you have to look over the algorithm again.