java - How 30%4 output is 2 but if I write 30*4/100 output is 1 -


system.out.println("30%4 = " + 30%4); system.out.println("33%4 = " + 33%4);  system.out.println("30*4/100 = " + 30*4/100); system.out.println("33*4/100 = " + 33*4/100); 

my question why 2 not 1 in 30%4 case. can explain me in details. in advance

the % operator modulo, takes remainder after division of 2 numbers, in case divides 30 4, highest multiple 7 7*4 = 28 remainder 2, answer, 33 case same, 8*4 = 32 remainder 1


Comments

Popular posts from this blog

1111. appearing after print sequence - php -

node.js - Express and Redis - If session exists for this user, don't allow access -

excel - I can't get the attachement of the email PHP -