Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
4 Distinct Integer Custom Code Generator
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { var random = new Random(); int[] nums = new int[4] {2,3,4,5}; int one; int two; int three; int four; List<string> storeList = new List<string>(); string[] storeArray = new string[9999]; string code; int i = 0; while(i < 2000) { one = nums[random.Next(0, nums.Length)]; two = nums[random.Next(0, nums.Length)]; three = nums[random.Next(0, nums.Length)]; four = nums[random.Next(0, nums.Length)]; code = one.ToString() + two.ToString() + three.ToString() + four.ToString(); if(one == two || one == three || one == four || two == three || two == four || three == four) { } else { storeList.Add(code); } storeArray = storeList.ToArray(); i++; } List<string> distinctStoreList = storeList.Distinct().ToList(); distinctStoreList.Sort(); for (int j = 0; j<storeArray.Count(); j++) { Console.WriteLine(distinctStoreList[j]); } } } }
run
|
edit
|
history
|
help
0
Given a list of numbers and a number k, return whether any two numbers from the list add up to k
Insert m into n
Program 1
HSC
and
Enumerable
Jp-trize
Remove Duplicate characters from String
30272 Program Ex3
Linear search vs. Binary search