Integers stay whole: floor and % split minutes into hours and minutes.
Whole-number mathsDatatypes
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.
import math
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
total = int(input("Total minutes "))hours = math.floor(total / 60)minutes = remainder_of(total, 60)print(str(total) + " minutes is " + str(hours) + " h " + str(minutes) + " min")How each block becomes code: Python · Java · C++ · C# · JavaScript