How is the rounding code ?2.553 to 2.6 if the second decimal number is 5 and the first decimal number is an odd number, and ... | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

How is the rounding code ?2.553 to 2.6 if the second decimal number is 5 and the first decimal number is an odd number, and ...

2.65436 becomes 2.6 if the second decimal digit is 5 and the first decimal number is an even number.

24th Jul 2022, 9:33 AM
Zulpakar
Zulpakar - avatar
3 Antworten
+ 1
In which language you are asking about? And what is your try?
24th Jul 2022, 9:45 AM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 code for javascript..🙏 I need to rounding value 2.5578997664434 to 2.6
24th Jul 2022, 9:57 AM
Zulpakar
Zulpakar - avatar
+ 1
console.log((2.555).toFixed(1)); Num.toFixed(n) ; rounds Num's precision value to n number of places...
24th Jul 2022, 10:11 AM
Jayakrishna 🇮🇳