Can you guys explain what's modulo operation in Java??? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

Can you guys explain what's modulo operation in Java???

7th Jan 2018, 9:07 PM
Cryptic Raeen
Cryptic Raeen - avatar
10 Answers
+ 6
it's for calculating the remainder! if a number n=ax+b [b is less than both a and x] and we try to divide it with a, we get x but b remains as a remainder! so it's like divide 10 with 3... you get 3*3=9 and 1 remains as 9+1=10. so here 1 is the remainder. so to find the remainder you have to use % operator.. int remainder; remainder = 10%3; // value is 1 remainder = 10%5; // value is 0 because 5 completely divides 10 remainder=23%4; // remainder is 3. 4*5+3=20
25th Apr 2018, 12:18 PM
Jaber Ahmed
Jaber Ahmed - avatar
+ 1
haha man i knew it how long u been coding
8th Jan 2018, 2:22 PM
Ahmed Abdi
Ahmed Abdi - avatar
+ 1
lol same
11th Jan 2018, 7:04 AM
Ahmed Abdi
Ahmed Abdi - avatar
+ 1
thanks Jaber Ahmed... I've got it ♥️
25th Apr 2018, 12:24 PM
Cryptic Raeen
Cryptic Raeen - avatar
+ 1
modulus is what is remained after you perform a division 3 / 2 then the modulus is 1
30th Apr 2018, 7:01 PM
Sharika
Sharika - avatar
+ 1
it’s the same in all languages
22nd May 2018, 1:18 PM
Delower Sumon
Delower Sumon - avatar
0
I seem to understand know it only tells the remainder duh
8th Jan 2018, 2:12 PM
Ahmed Abdi
Ahmed Abdi - avatar
0
I'm not helping am I lol
8th Jan 2018, 2:12 PM
Ahmed Abdi
Ahmed Abdi - avatar
0
guessing ur lvl u been here long what are in for(prison talk)
8th Jan 2018, 2:22 PM
Ahmed Abdi
Ahmed Abdi - avatar
0
Hi
25th Apr 2018, 4:12 PM
David Annan
David Annan - avatar