Created
May 21, 2017 13:00
-
-
Save miteshsureja/28b266ab05187c4a512076b8ac44c387 to your computer and use it in GitHub Desktop.
Display Prime Numbers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace RandomNumbers | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
bool isPrime = true; | |
for (int i=1; i<50; i++) | |
{ | |
isPrime = true; | |
for (int j = 2; j < i; j++) | |
{ | |
if (i % j == 0) | |
isPrime = false; | |
} | |
if (isPrime) | |
Console.Write(i + ", "); | |
} | |
Console.Read(); | |
} | |
} | |
} |
Author
miteshsureja
commented
May 21, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment