10001th prime: Difference between revisions
Content added Content deleted
Line 239: | Line 239: | ||
=={{header|C#|CSharp}}== |
=={{header|C#|CSharp}}== |
||
<lang csharp>using System; using System.Text; // |
<lang csharp>using System; using System.Text; // PRIMEQ.cs |
||
namespace p10001 // 10001 104743 |
namespace p10001 // 1 second 10001 104743 |
||
{ class Program |
{ class Program // rextester.com/YXNR89875 |
||
{ static void Main(string[] args) |
{ static void Main(string[] args) |
||
{ int max=10001; int n= |
{ int max=10001; int n=1; int p=1; int f; int j; |
||
while (n<=max) |
while (n <= max) |
||
{ f=0; j=2; |
|||
while (f < 1) |
|||
{ if (j >= Convert.ToInt32(Math.Pow(p,0.5))) |
|||
⚫ | |||
{ f=2; } |
|||
⚫ | |||
s++; |
|||
j++; |
|||
} |
|||
} |
|||
⚫ | |||
if (f != 1) { n++; } // Console.WriteLine("{0} {1}", n, p); |
|||
⚫ | |||
p++; |
|||
} |
|||
⚫ | |||
⚫ | |||
}}}</lang> |
}}}</lang> |
||
{{out}} |
{{out}} |