Programming Challenges


Results 1 to 15 of 279

Thread: Programming Challenges

Threaded View

  1. #11
    Join Date
    May 2001
    Location
    Uh, I'm somewhere where I don't know where I am.
    Posts
    1,228
    Originally posted by bwkaz
    Sure, just factor it.



    for(i=0; i<31; i++) { /* these +'s don't count, do they? */
    Easy way out:

    unsigned int i;

    for (i = 4294967295; i; i >>= 1)

    You'll get 32 shifts until i = 0, or 31 until i = 1, there's your counter.
    Last edited by tecknophreak; 08-22-2003 at 09:25 AM.
    if (i_forgot && this_is_about_code)
    language = c++;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •