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
4 Answers
+ 4
While learning java you will be knowing different types of calculating programs.
+ 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
+ 1
Oh dear, Thanks for the reply. Let me work it out and I will get back to you shortly..
+ 1
Hello Aysha, the code just worked fine as you told me... And could there be another way to present it?