Metode ceil modul math
Metode ceil modul math
melakukan pembulatan angka ke bilangan bulat selalu
ke atas.
Sintaksis
pythonimport math
math.ceil(angka)
Contoh
Mari bulatkan ke atas angka
25.38:
pythonimport math
print(math.ceil(25.38))
Hasil eksekusi kode:
python26
Contoh
Sekarang terapkan metode ceil pada angka
-4.88:
pythonimport math
print(math.ceil(-5.25))
Hasil eksekusi kode:
python-5