Show A Number To Two Decimal Places

[Solved] Show A Number To Two Decimal Places | Perl - Code Explorer | yomemimo.com
Question : Show a number to two decimal places

Answered by : encouraging-echidna-b77ai08w7a4z

echo round(520.34345, 2); // 520.34
echo round(520.3, 2); // 520.3
echo round(520, 2); // 520

Source : https://stackoverflow.com/questions/4483540/show-a-number-to-two-decimal-places | Last Update : Mon, 31 Jan 22

Question : 2 decimal places

Answered by : clean-curlew-tq3zl5mmskb6

a = 2.156422
print("%.2f" % a)
a = 1.234567
def getfloat(float):	formated = "{:.2f}".format(float)	return formated
print(getfloat(a))

Source : https://www.codegrepper.com/app/my_answers.php | Last Update : Sun, 28 Nov 21

Answers related to show a number to two decimal places

Code Explorer Popular Question For Perl