Re: do something every 1000 records or so



On May 15, 10:36 am, Richard Senior <nos...@xxxxxxxxxxxxxxxxxxxx>
wrote:
Jo wrote:
Ok, this could be a perfect exam question, but it isn't and i need a
good solution

I'll believe you.

if beginRange == 0 || "some condition so it prints every 1000 records" {

I think you need the modulo (%) operator. This gives the remainder of an
integer division, which will, of course be zero every n records when you
modulo by n. For example 25 % 25 == 0, 50 % 25 == 0, 51 % 25 == 1 and so on.

--
Regards,

Richard

hi there:
the problem is that i dont have an exact brake, ie if i do a module on
1050 i ll get 1, and some mod
but what happens when i get 1090? i ll get 1 again, so how do i make
it print only the first time ?

.



Relevant Pages

  • Re: Bug in expr ?
    ... >> Note however that remainder (aka modulo) is negative, ... Modulo numbers are never negative. ... Remainder can be whatever you ... "Modulo" has multiple meanings, especially accoring to context, e.g. mathematics vs. computing. ...
    (comp.lang.tcl)
  • Re: Representing sets of points
    ... defined in a coordinate system by these ... Given an integer m, we say that "a and b are congruent modulo m", ... This is usually called "division with remainder", ... this is seldom used by mathematicians. ...
    (sci.math)
  • Re: Order modulo p^n (Number Theory)
    ... modulo. ... order via theorems and was getting know where. ... that is the order or the order divides p^n-1. ... powers less than n-1 the expansion dosent give the remainder 1 and the ...
    (sci.math)
  • Re: Integer division, surprising results
    ... > A remainder is always positive, ... Remainders are always positive, but modulo can be ... There are pros and cons for doing it either ...
    (comp.lang.python)
  • Re: % operator incompatibility...
    ... > Try Pascal and Ada as well. ... Fortran defines two functions: ... MODULO - the modulo function ... I think the confusion arises because people assume that the remainder ...
    (comp.lang.tcl)

Loading