+ 2
Help needed
What is the output of this code? int var1=5; int var2=6; int var3; var3 =++var2*var1 /var2+var2; System.out.print(var3); How is the answer to this 12. Thank you.
3 Answers
+ 4
var3 =(7×5)/7 + 7
= 35/7 + 7
= 5+7
=12
+ 3
yeah, classic gotcha!, good answer HK.
It is always tempting to add the numbers together first then use division.
But in maths there is operator precedence so
*and / get processed before + and -.
+ 2
Thank you so much man
Hot today
Python — File Handling
0 Votes
Help me solve this (using loop)
3 Votes
What is wrong? Error on test.
1 Votes
Help me wiht python
1 Votes
Question is write a c program to print prime numbers up to n and print the largest number in array.
1 Votes
Help me
0 Votes