+ 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 Answers
+ 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 šŸ‡®šŸ‡³