Here is a ready made function in C# that lists all primes greater than 2 and less than 100. protected void GetPrimes() { int i, j; i = 2; j = 100; StringBuilder sb = new StringBuilder(); while (i < 100) { if ((j % i) == 0) //not a prime { j = j - 1; i = 2; continue; } else { i = i + 1; } if (i==j) { sb.Append(j.ToString()+ ", "); } } MessageBox.Show(sb.ToString()); }//end
The mark of the man who thinks...sometimes
Poetry, Chess, Programming, Philosophy, Philanthropy etc.
Twitter Handle @petrushkagoogol
External Spaces
https://themindspace.quora.com/?ch=10&oid=2086271&share=396067ef&srid=XrZim&target_type=tribe