Results 1 to 2 of 2

Thread: How to produe all combinations of a 10 binary digit number?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Mar 2006
    Posts
    108

    Unhappy How to produe all combinations of a 10 binary digit number?

    Hi,

    I need to write a program which can produce all different combinations of a 10 binary digit sequence. e.g 2^10 or 1024 different binary values.

    e.g 0000000000, 0000000001, 0000000010, 0000000011, ..........., 1111111111

    Anyone knows?

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: How to produe all combinations of a 10 binary digit number?

    VB Code:
    1. For i As Integer = 0 To 1023
    2.     MessageBox.Show(Convert.ToString(i, 2).PadLeft(10, "0"c))
    3. Next i
    Last edited by jmcilhinney; Feb 14th, 2007 at 04:49 PM. Reason: Changed PadRight to PadLeft.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

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



Click Here to Expand Forum to Full Width