title: obtaining two large numbers and reducing their difference by taking their mod values iteratively in C
body: <p>Well, let us say i am supposed to obtain D = (A - B) mod M, where A and B are very large, large as in, long long wont help. A and B were obtained iteratively and independently and i would obtain A mod M at each iteration and B mod M at each iteration. Now, let us say B is always smaller than A, but (B mod M) can be larger than (A mod M), then when D is evaluated, a negative number will be obtained, which isnt right, because, well, B is smaller than A. How do I go about this? Thanx in advance.</p>