Here I am writing a program in C # which searches for the prime number, a major number is more than 1 natural number, which has 1 and there is no positive separator other than itself.
Like : 3,5,7 etc.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication19
{
class Program
{
static void Main(string[] args)
{
bool isPrime = true;
Console.WriteLine("Prime Numbers in 1 to 100 : ");
for (int i = 2; i <= 100; i++)
{
for (int j = 2; j <= 100; j++)
{
if (i != j && i % j == 0)
{
isPrime = false;
break;
}
We use cookies to ensure you have the best browsing experience on our website. By using our site, you
acknowledge that you have read and understood our
Cookie Policy &
Privacy Policy.
Prime Number between 1 to 100
Here I am writing a program in C # which searches for the prime number, a major number is more than 1 natural number, which has 1 and there is no positive separator other than itself.
Like : 3,5,7 etc.
Out Put is :