---
title: "How can Display All the Prime Numbers Between 1 to 100 ?"  
description: "How can Display All the Prime Numbers Between 1 to 100 ?"  
author: "Anonymous User"  
published: 2018-09-20  
updated: 2018-10-26  
canonical: https://www.mindstick.com/forum/34677/how-can-display-all-the-prime-numbers-between-1-to-100  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# How can Display All the Prime Numbers Between 1 to 100 ?

Display All the Prime Numbers Between 1 to 100.

## Replies

### Reply by Anonymous User

## 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.

```
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;
                    }

                }
                if (isPrime)
                {
                    Console.Write("\n" + i);
                }
                isPrime = true;
            }
            Console.ReadKey();
        }
    }
}
```

![How can Display All the Prime Numbers Between 1 to 100 ?](https://www.mindstick.com/mindstickforums/22d5a166-6b16-428f-b9fc-db6267aa3137/images/56043eaf-9a63-45d2-921f-6cf6376fd256.png)

Out Put is :

![How can Display All the Prime Numbers Between 1 to 100 ?](https://www.mindstick.com/mindstickforums/22d5a166-6b16-428f-b9fc-db6267aa3137/images/0444cd86-5c1d-4faf-94be-28bd52a0aeee.png)\


---

Original Source: https://www.mindstick.com/forum/34677/how-can-display-all-the-prime-numbers-between-1-to-100

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
