Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
FINAL PRIME NUMBER GENERATOR IN C#
//Rextester.Program.Main is the entry point for your code. Don't change it. //Microsoft (R) Visual C# Compiler version 2.9.0.63208 (958f2354) using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { double prime = 0; double count = 6; double iterations =100; double i = 0; double j = 0; for (i=1; i<=double.PositiveInfinity; i++) { if (count == iterations){ Console.WriteLine($"Count has reached zero, Product is {prime}"); break;} if (i%2!=0 && i%3!=0 && i%5!=0 && i%7!=0 && i%11!=0 && i!=1 && count>0) { for (j=13; j<=(i-1); j++) { if (i%j == 0) { Console.WriteLine($"non prime"); goto i2; } } prime = i; Console.WriteLine($"prime{count}, {prime}"); count+=1; } i2: if (count == iterations){ Console.WriteLine($"Count is zero...breaking loop"); break;} } Console.WriteLine($"the final count is {count}"); } } }
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
Plt-D v.0.8.4
Linked list solution with remove
Game 1.0.2
abababa sub string
Set Get
Min max elements swap of the array
Número primers
Watch Jurassic World Dominion Online Free
Hello World!
vjghfgh
Please log in to post a comment.