Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Modulus Division

Tags:

java

modulus

I recently enrolled in a Java class and I have a question regarding modulus division.

I get an example in my textbook:

( 100 - 25 * 3 % 4 ) = 97

How does this equal 97? I’ve tried every single possiblity and I just can’t seem to figure it out.

Can someone please be so kind to break it down for me.

Thanks in advance.

like image 874
DaBruh Avatar asked Sep 03 '26 04:09

DaBruh


1 Answers

Operator Precedence

( 100 - ((25 * 3) % 4) ) = 97

25*3=75

75 MODULO 4=3

100-3=97

That's it.

When you're unsure about operators' priority put parentheses everywhere.

like image 122
StephaneM Avatar answered Sep 04 '26 20:09

StephaneM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!