Skip to content

Instantly share code, notes, and snippets.

@miteshsureja
Created May 21, 2017 13:00
Show Gist options
  • Save miteshsureja/28b266ab05187c4a512076b8ac44c387 to your computer and use it in GitHub Desktop.
Save miteshsureja/28b266ab05187c4a512076b8ac44c387 to your computer and use it in GitHub Desktop.
Display Prime Numbers
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();
}
}
}
@miteshsureja
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment