The remainder of the quotient of two numbers (usually integers).
Questions tagged [modulus]
847 questions
-2
votes
3 answers
C# Operator Modulus?
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WholeNumbers1
{
class Program
{
static void Main(string[] args)
{
int sum = 0;
…

TDOT L
- 45
- 2
- 10
-2
votes
2 answers
Python: Generating a Text from CSV with every 5th row Having a Different Function
I need to convert a .csv output into a string of keystrokes for a different program to perform automated billing. For the most part it would work if I only had to automate 4 at a time. That's the output from the regOutput() function.
The software…

Corey Lloyd
- 19
- 5
-2
votes
2 answers
While loop with random number generator?
I am new to java coding and while loops are a little confusing to me.
For this program I am asked to generate a random number between 1 and 100, I think I've got that part down.
First the code would print out the random value, and then, if the…

Clarisa
- 125
- 2
- 12
-2
votes
2 answers
% operation for two vectors in C++
I have two vectors A and B (with x,y & z coordinates) and I want to know whether A % B is a valid operation or not as I read somewhere that / operation is not valid for two vectors and since % involves division so hence the confusion. If % is valid…

user2966197
- 2,793
- 10
- 45
- 77
-2
votes
2 answers
C++ calculate sum of integers excluding multiples of 3
I'm stumped on a VERY frustrating problem. Trying to code out a prompt to input an integer and output the sum of integers between 1 and the number entered while excluding multiples of 3 during the sum. Any help is greatly appreciated!
Here is what…

ljamison
- 115
- 1
- 10
-2
votes
1 answer
PHP modulus to wrap divs and ignoring LIMIT
I'm trying to add a container every 2 iterations. I've implemented a count, but I'm getting weird results as I inspect the page.
Any ideas what may be going on and what I may be doing wrong with the wrapper injection?

user3135730
- 320
- 1
- 3
- 8
-2
votes
1 answer
What to use instead of modulus?
I am writing a program that simulates a round robin style cpu scheduler. After timestamp (variable input in the command line) number of time units, the scheduler should move that process down to the bottom of the queue and resume with the next…

xjsc16x
- 278
- 1
- 6
- 16
-2
votes
2 answers
Python - prime numbers behaving badly
I'm writing a prime number program and I'd like a hint, it currently prints primes except for numbers divisible by 3 and 5 in starting at 9 and 15, but somehow accurately computes 20, also a multiple of 5, as not prime. Any help appreciated. Using…

CT Hildreth
- 205
- 1
- 2
- 8
-2
votes
2 answers
Modulus without math operators
I want to create a method which given a number n and the number 16 and applies the modulus operator to them (n % 16). The thing which makes it hard for me is that I need to not use any of math operators (+, -, /, *, %).

Wazery
- 15,394
- 19
- 63
- 95
-2
votes
1 answer
Covert flat column into multiple columns
I have a sheet with data in this format:
ID TYPE FEED SUB-F START_TIME KEY VALUE
1 BMMM sc11 sc11-1 7:32:43 AM VAL_MSTIME 1382702237170
1 BMMM sc11 sc11-1 7:32:43 AM VAL_AMSUBMI 26345
1 BMMM sc11 sc11-1…

locorecto
- 1,178
- 3
- 13
- 40
-2
votes
1 answer
I can't seem to calculate with modulus
Its been a few months since I graduated from a tech school (HS level) for programming, and my JavaScript is a bit rusty. I'm just trying to calculate Y%X=Z with textbox inputs. However Z always results in NaN, so I'm assuming my problem is the…

Brandon Durst
- 1
- 4
-2
votes
1 answer
Is there a "Modulus Equals" operator?
position = 14
position = position - position%3
=> 12
That code above works, but I am loath to reference position three times. Is there an equivalent ++ for what I am attempting to do above? I envision something like position =-%3.
I can't find…

Theta
- 175
- 8
-2
votes
2 answers
(a^k(p-1)+ b) mod(p) here p is a prime number and a,b,k is an integer greater than 1 and a not divisble by p. Is this value same as (a^b)mod(p)?
According to Fermat's Little theorem a^(p-1) mod(p) is 1. So a^k(p-1) mod(p)will also be 1 by splitting into k parts and apply modulus independently we get '1'. Am I missing something?

Alex
- 1,178
- 3
- 9
- 24
-2
votes
1 answer
List modulus error
p is a list of integers.
std::list p;
if ( 2 % p(0) == 0 );
But p has "expression must have integral or unscoped enum type" error.
Why?
user2002000
-2
votes
1 answer
how to calculate (A*B*C)%10000007 where A,B,C can be at maximum 10^18
how to calculate (A*B*C)%10000007 where A,B,C can be maximum 10^18

Amar J. Kachari
- 9
- 1