Thread: Loop question

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    1
    Rep Power
    0

    Loop question


    Im trying to

    http://s1097.photobucket.com/user/princejan7/media/Project2_zps9fa3350c.png.html

    So I think the loop should look something like this. But I don't know what *** should be.


    Code:
    while (***)
       create array
             
          for i=0,i<30,i++
              if(my_array[i][i]<7)
              counter++
    Any suggestions?
  2. #2
  3. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Location
    India
    Posts
    95
    Rep Power
    4
    try with counter==30

    if all diagonal element are more than 7 then only counter will reach to 30.
  4. #3
  5. Lord of the Dance
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Oct 2003
    Posts
    3,581
    Rep Power
    1906
    He want to exit the loop (read: stop creating new array) when the counter IS EQUAL to 30, which means he want to keep running the loop while counter IS NOT EQUAL to 30.

    Therefore, he should try with: while(counter != 30).
  6. #4
  7. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    Originally Posted by MrFujin
    He want to exit the loop (read: stop creating new array) when the counter IS EQUAL to 30, which means he want to keep running the loop while counter IS NOT EQUAL to 30.

    Therefore, he should try with: while(counter != 30).
    Or, since the value of counter can only increase in that loop:
    while(counter < 30)

IMN logo majestic logo threadwatch logo seochat tools logo