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

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

android - How to create dynamically Fragment pager adapter -

1111. appearing after print sequence - php -