using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PrimeNumber
{
class PrimeNumber
{
static void Main(string[] args)
{
bool isPrime = true;
Console.WriteLine("Prime Numbers : ");
for (int a = 2; a <= 100; a++)
{
for (int b = 2; b <= 100; b++)
{
if (a != b && a % b == 0)
{
isPrime = false;
break;
}
}
if (isPrime)
{
Console.Write("\t" +a);
}
isPrime = true;
}
Console.ReadKey();
}
}
}
-------------OUTPUT:----------
Prime Numbers :
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97
------------------------------------------
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace PrimeNumber
{
class PrimeNumber
{
static void Main(string[] args)
{
bool isPrime = true;
Console.WriteLine("Prime Numbers : ");
for (int a = 2; a <= 100; a++)
{
for (int b = 2; b <= 100; b++)
{
if (a != b && a % b == 0)
{
isPrime = false;
break;
}
}
if (isPrime)
{
Console.Write("\t" +a);
}
isPrime = true;
}
Console.ReadKey();
}
}
}
-------------OUTPUT:----------
Prime Numbers :
2 3 5 7 11 13 17 19 23 29
31 37 41 43 47 53 59 61 67 71
73 79 83 89 97
------------------------------------------
thanks for posting good artical
ReplyDeleteThanks...keep eyes here
DeleteThis comment has been removed by the author.
ReplyDeleteKeep Posting, nice article
ReplyDeleteThanks :)
Delete