0

[WHAT IS WRONG] A java program that calculates the sum of three integers

https://code.sololearn.com/c4XGns3BHJRF/?ref=app

7th Oct 2021, 8:29 AM
ruiririririri
ruiririririri - avatar
7 ответов
+ 2
ruiririririri pow is method of Math class not Double class And double is a data type and data type don't have method, data type are just a value. To get power we use pow() method of Math class so there should be s = Math.pow(a, 3) + Math.pow(b, 3) + Math.pow(c, 3);
7th Oct 2021, 8:36 AM
A͢J
A͢J - avatar
+ 2
ruiririririri You made mistake in taking user input. This is the way to take user input in java a = sc.nextDouble(); b = sc.nextDouble(); c = sc.nextDouble ();
7th Oct 2021, 8:39 AM
Arun Ruban SJ
Arun Ruban SJ - avatar
+ 2
ruiririririri There is one more problem, you have used unnecessary { } Also you are not taking user input Here is correct code https://code.sololearn.com/c8HU8uI7Rak5/?ref=app
7th Oct 2021, 8:40 AM
A͢J
A͢J - avatar
+ 1
A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ Thank you for your help. Have a nice day!
7th Oct 2021, 8:42 AM
ruiririririri
ruiririririri - avatar
+ 1
Arun Ruban SJ Hi! Thank you for correcting me. Have a nice day.
7th Oct 2021, 8:42 AM
ruiririririri
ruiririririri - avatar
0
ruiririririri What's double.pow() And why +s double is a data type not a class Double is a class
7th Oct 2021, 8:32 AM
A͢J
A͢J - avatar
0
Hi A͢J - S͟o͟l͟o͟H͟e͟l͟p͟e͟r͟ I wanted to insert an expression that cubes the inputted number. I know it’s wrong. How can I fix it?
7th Oct 2021, 8:33 AM
ruiririririri
ruiririririri - avatar