Thread: Coding for "every 17th"

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Jun 2003
    Posts
    361
    Instead of using division, could you use modulus? (The % operator) Which returns the Remainder.

    So:
    1 % 17 = 1
    5 % 17 = 5
    17 % 17 = 0
    20 % 17 = 3
    34 % 17 = 0
    51 % 17 = 0

    And that way, just check when i % 17 = 0 (meaning the i value is divisible by 17 with no remainder) and fire the event then?

  2. #2
    Registered User
    Join Date
    Dec 2001
    Posts
    367
    Of course. I tried that and it solves it all. Thanks alot

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 9
    Last Post: 03-20-2009, 05:22 PM
  2. Coding Guideline ....!!
    By imfeelingfortun in forum Tech Board
    Replies: 8
    Last Post: 10-08-2006, 07:09 AM
  3. Before Coding
    By cyberCLoWn in forum C++ Programming
    Replies: 16
    Last Post: 12-15-2003, 02:26 AM
  4. Coding Contest....
    By Koshare in forum A Brief History of Cprogramming.com
    Replies: 46
    Last Post: 10-14-2001, 04:32 PM