- 3

Eval function wrong calculating

If user calculate 5 + 5 * 10 it's gonna return 55, which is wrong it's should be 100. And how to fix it https://code.sololearn.com/WRh3fh8viTWq/?ref=app

15th Dec 2021, 4:35 AM
EsaKurniawan
7 Respostas
+ 4
Nop it's not wrong It also follows BODMAS rule of basic maths so if you do (5+5)*10 then it will first solve bracket and return 100 else it will first do 5*10 then add 5 to give 55
15th Dec 2021, 4:37 AM
Ayush Kumar
Ayush Kumar - avatar
+ 3
EsaKurniawan add a bracket button also in your calculator. I allready told (5+5)*10 will give you 100
15th Dec 2021, 4:42 AM
Ayush Kumar
Ayush Kumar - avatar
15th Dec 2021, 4:38 AM
Simon Sauter
Simon Sauter - avatar
0
There's nothing to fix apart from your math skills.
15th Dec 2021, 4:40 AM
Simon Sauter
Simon Sauter - avatar
0
How to make it equal 100
15th Dec 2021, 4:40 AM
EsaKurniawan
0
Or just hit "=" after "5+5".
15th Dec 2021, 4:47 AM
Simon Sauter
Simon Sauter - avatar
0
Thanks a lot all of you guys for helping me I'll try your advice
15th Dec 2021, 4:49 AM
EsaKurniawan