using System;
class prime
{
int i,c,b;
void insert()
{
Console.WriteLine("Enter your value");
b=Convert.ToInt32(Console.ReadLine());

for(int j=1; j<=b; j++)
{
for(i=2; i {
c=j%i;
if(c==0)
{
/*Console.WriteLine("Not prime {0}",j);*/
break;
}
}
if(c!=0)
{
Console.WriteLine("Prime {0}",j);
}
}
}
public static void Main(string[] arg)
{
prime p = new prime();
p.insert();
Console.Read();
}


}

Like it on Facebook, Tweet it or share this article on other bookmarking websites.

No comments