Nearest multiple of 10 Python
PROGRAM TO ROUND THE GIVEN NUMBER TO NEAREST MULTIPLE OF 10
OUTPUT
4720
# function to round the numberdef round( n ): # Smaller multiple a = (n // 10) * 10 # Larger multiple b = a + 10 # Return of closest of two return (b if n - a > b - n else a)# driver coden = 4722print(round(n))
4720
Comments
Post a Comment