A Real temperature in, a Real temperature out, rounded to one place.
Real numbersDatatypes
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 round_half_up(x, digits=0): # Like round() in B4Coder: a half goes up, so 2.5 is 3 (Python's round() gives 2). scale = 10 ** digits whole = math.floor(x * scale) if x * scale - whole >= 0.5: whole += 1 return whole if digits == 0 else whole / scale
celsius = float(input("Temperature in °C "))fahrenheit = round_half_up(celsius * 9 / 5 + 32, 1)print(str(celsius) + " °C is " + str(fahrenheit) + " °F")How each block becomes code: Python · Java · C++ · C# · JavaScript