+ 1
Error creating a calculator with java
I wrote a code to make a java calculator I run it but the SoloLearn playground donât allow me to take in my user input I tried this on another app compiler and it works fine what do I do The code link https://code.sololearn.com/cP9BMOUL5lNu/?ref=app
9 Answers
+ 3
System.out.printf("product of both numbers is: %d", product);
+ 2
Insert your code in your question
+ 2
alternatively cast ti float or double
System.out.printf("product of both numbers is: %f", (double)product);
+ 1
Please comment answers to help
0
comment what? what is the source? what is the input sequence you are trying? the fried air cannot be commented on
Use the other app as it works
0
I just added the code
0
because you read two integers, you store the product in an integer and then try to display a float. Use %d not %f
in the input box test
5 6
and submit. unfortunately the rendering in the playground is not that of the execution on the pc but It works
0
Ciro pellegrino thanks it worked but the outputs are in decimals e.g 4.0000
How do i make the output be in integer or whole numbers
0
System.out.printf("product of both numbers is: %d", product);