Share Pastebin
Guest
Public paste!

xvedejas

By: a guest | Nov 28th, 2008 | Syntax: C# | Size: 0.58 KB | Hits: 60 | Expires: Never
Copy text to clipboard
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace duplicates
  5. {
  6.         class MainClass
  7.         {
  8.                 public static void Main(string[] args)
  9.                 {
  10.                         int max = 10000;
  11.                         List<int> numbers = new List<int>();
  12.                        
  13.                         for ( int i = 0; i < max; i++ )
  14.                         {
  15.                                 bool pass = true;
  16.                                 foreach ( char character in i.ToString() )
  17.                                 {
  18.                                         if ( i.ToString().IndexOf( character ) != i.ToString().LastIndexOf( character ) )
  19.                                         {
  20.                                                 pass = false;
  21.                                         }
  22.                                 }
  23.                                 if ( pass ) { numbers.Add( i ); }
  24.                         }
  25.                        
  26.                         foreach ( int number in numbers ) {     Console.WriteLine( number ); }
  27.                 }
  28.         }
  29. }