About 50,300 results
Open links in new tab
  1. modulo - What's the syntax for mod in java - Stack Overflow

    Nov 17, 2015 · Java actually has no modulo operator the way C does. % in Java is a remainder operator. On positive integers, it works exactly like modulo, but it works differently on negative …

  2. Understanding The Modulus Operator % - Stack Overflow

    Jul 8, 2013 · % is called the modulo operation. For instance, 9 divided by 4 equals 2 but it remains 1. Here, 9 / 4 = 2 and 9 % 4 = 1. In your example: 5 divided by 7 gives 0 but it remains 5 (5 % …

  3. java - How do I use modulus for float/double? - Stack Overflow

    Jun 1, 2010 · fmod is the standard C function for handling floating-point modulus; I imagine your source was saying that Java handles floating-point modulus the same as C's fmod function. In …

  4. Using the modulo operator in java - Stack Overflow

    Aug 5, 2019 · I'd like to ask about using the modulus operation, could someone tell me how to use an if statement, why use [== 0], but we can assign the value from a modulus calculation into …

  5. What are the practical uses of modulus (%) in programming?

    Aug 28, 2010 · Except the mathematical perspective, different languages use this symbol for defining built-in data structures, like in Perl %hash is used to show that the programmer …

  6. Using modulus operator in for Loop with if statements - Java …

    Jan 12, 2018 · Java modulo operation using for loop. 2. Having trouble with the mod operator; I'm not getting the result ...

  7. Modular Math in Java (Number Line which Wraps Around)

    Jan 3, 2011 · The modulo operation is what you want. However, the % operator in Java, which is often called modulo, isn't the mathematical modulo. It's rather the remainder operator. The …

  8. java - Check whether number is even or odd - Stack Overflow

    Sep 8, 2011 · This is because Java has in its modulo operation the sign of the dividend, the left side: n. So for negatives and positives dividends, the modulo has the sign of them. Of course, …

  9. java - Help trying to understand modulo operation in circular array ...

    May 11, 2011 · i have a small issue trying to figure out how a modulo operation is being calculated. I am building up a queue, so i have a circular array. i cannot figure out how this …

  10. java - How to get the correct output in Modulo (10^9 + 7) format ...

    Jul 1, 2022 · What will be calculated? Where the assignment says "you have to calculate x to the power of n, modulo 10^9+7 i.e. calculate (x^n) % (10^9+7).", what is your understanding of …