ango
ango

Reputation: 869

Reorganizing a formula containing Modulo

I have a formula that looks like
a = (b + 1 + c)%d
I want to express c in terms of rest, i.e. have "C" on the LHS.
Any suggestions ?

Upvotes: 2

Views: 89

Answers (1)

trutheality
trutheality

Reputation: 23465

a = (b + 1 + c)%d
a + n*d = b + 1 + c
a -1 - b + n*d = c

For any integer n.

Upvotes: 10

Related Questions