Write a java program that can execute. 10.5 + 2*5 / 45 - 3.5 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Write a java program that can execute. 10.5 + 2*5 / 45 - 3.5

Am a beginner in programming trying to learn Java...any help would be appreciated

30th Mar 2021, 2:26 AM
Kugan Derrick
Kugan Derrick - avatar
4 Answers
+ 4
While learning java you will be knowing different types of calculating programs.
30th Mar 2021, 11:24 AM
Aysha
Aysha - avatar
+ 2
Just try it in this way double hello = 10.5 + 2*5 / 45 - 3.5; System. out. println(hello); We use double as data type bcz here result will be in decimal point. We have to give a name to a variable I gave hello, you can give any name to it. Then simply give output statement and you will get the output 7.0
30th Mar 2021, 3:25 AM
Aysha
Aysha - avatar
+ 1
Oh dear, Thanks for the reply. Let me work it out and I will get back to you shortly..
30th Mar 2021, 8:15 AM
Kugan Derrick
Kugan Derrick - avatar
+ 1
Hello Aysha, the code just worked fine as you told me... And could there be another way to present it?
30th Mar 2021, 8:23 AM
Kugan Derrick
Kugan Derrick - avatar