Finding every nth number in an array set

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • babe20042004
    New Member
    • Oct 2008
    • 8

    Finding every nth number in an array set

    How would I go about finding every nth number in an array set? For example if i had a set containing the numbers 1-100 int each cell, how would I go about finding every 3rd number in the set.
  • boxfish
    Recognized Expert Contributor
    • Mar 2008
    • 469

    #2
    Use a for loop, but instead of incrementing the counter variable by one each time, add three to it.
    Hope this helps.

    Comment

    • whodgson
      Contributor
      • Jan 2007
      • 542

      #3
      Yes as boxfish says instead of for(i=0;i<sardi nes; i++) the increment i++ could be expressed as i+=3

      Comment

      Working...