Split minutes into hours and minutes using %.
RemaindersBeginner
Built from 3 kinds of block, between Start and End. Each one has a guide.
B4Coder writes the same program as real code. Change the flowchart in the editor and the code changes with it.
def remainder_of(a, b): # Like % in B4Coder: the remainder has the sign of a, so -7 % 3 is -1 (Python's % gives 2). r = abs(a) % abs(b) return -r if a < 0 else r
minutes = int(input("How many minutes? "))leftover = remainder_of(minutes, 60)hours = (minutes - leftover) / 60print(str(minutes) + " minutes is " + str(hours) + " hour(s) and " + str(leftover) + " minute(s).")How each block becomes code: Python · Java · C++ · C# · JavaScript