Guys pls explain my that | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys pls explain my that

/ and * and %. in Java.

25th Dec 2016, 11:36 PM
imad
imad - avatar
4 Answers
+ 1
/ is normal division (4/2 = 2) * is normal multiplication (2*2 = 4) and % is modulo calculation (3%2 = 1) What is exactly the issue you wanna talk about?
25th Dec 2016, 11:41 PM
Andreas K
Andreas K - avatar
+ 1
% this is difficult
25th Dec 2016, 11:42 PM
imad
imad - avatar
+ 1
thanks man
25th Dec 2016, 11:46 PM
imad
imad - avatar
+ 1
% means modulo. When you are calculating with modulo is division by complete numbers like 1, 2, 3, 4,..., n. In other words there are no floating point numbers in this division. Here are some examples 5 modulo 2 = 2 * 2 + 1 ---> 5%2 = 1 10 modulo 4 = 4 * 2 + 2 ---> 10%2 = 2 1 modulo 2 = 0 + 1 ---> 1%2 = 1 4 modulo 2 = 2 * 2 + 0 ---> 4%2 = 0
25th Dec 2016, 11:54 PM
Andreas K
Andreas K - avatar