Click here to Skip to main content
15,887,267 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hello Folks,

Can you help me how to find out unique combination of digits for 1-99 digits eg.

{1, 2, 3, 4}

But the combination should be unique using C# language.

Can any body give me any hint. I know how to find combinations, but the problem is how to find unique combination only.

Thanks

Member
Posted
Comments
Sergey Alexandrovich Kryukov 10-Nov-11 16:27pm    
Not clear. The requirements should be mathematically precise. Which combinations you define as different or equivalent? Also, explain what is your problem?
--SA

1 solution

C#
for(int a = 1; a < 97; a++)
  for(int b = a + 1; b < 98; b++)
    for(int c = b + 1; c < 99; c++)
      for(int d = c + 1; d < 100; d++)
        Console.WriteLine( a.ToString() + " " +
                           b.ToString() + " " +
                           c.ToString() + " " +
                           d.ToString());
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900