Code not working | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Code not working

This is a test on the java course, but i can't figure out what's wrong with this, It gives me an error on test case Number 3, which i can't see https://code.sololearn.com/cwOLO3WO0dIj/?ref=app

11th May 2022, 12:13 PM
Lorenzo Spada
Lorenzo Spada - avatar
5 Answers
+ 1
Use System.out.println(Math.PI*width*width); Instead of System.out.println(width*width*Math.PI);
11th May 2022, 12:23 PM
Jayakrishna 🇮🇳
+ 1
Jayakrishna🇮🇳 thanks, this works, but why?
11th May 2022, 12:32 PM
Lorenzo Spada
Lorenzo Spada - avatar
+ 1
There you get a slite rounding difference.. because of different types of data. Check the code with width=11
11th May 2022, 12:40 PM
Jayakrishna 🇮🇳
+ 1
Thanks, now in understand
11th May 2022, 12:43 PM
Lorenzo Spada
Lorenzo Spada - avatar
+ 1
You're welcome..
11th May 2022, 12:44 PM
Jayakrishna 🇮🇳