## PHP Program to Print Prime Numbers between 1 to N using Sieve Algorithm

Write a php program to print prime numbers between 1 to N. In this tutorial, we are going to use Sieve of Eratosthenes algorithm to print prime numbers between 1 to N.

## Check Prime Number in Java

How to check prime number in Java. In this tutorial, we are going to write a Java program to check whether a number is prime or not. Also In this tutorial, we’ll discuss multiple approaches and their time complexity to solve this problem.

Before writing a program, let’s quickly understand what is a prime number.

### What is Prime Number?

A prime number is a number that is greater than 1 and it has no positive divisors other than 1 and itself.

Subscribe Our Tutorials

For example – 3, 13, 7  is a prime number, as it’s divisible by 1 and itself. Similarly, 29, 19 etc. are also prime numbers.

6 is not a prime number as it’s divisible by 1, 2, 3 and 6.

2 is the only even prime number.

## C Program to Check whether a Number is Prime or Not

Write a c program to check whether a number is prime or not. In this tutorial, we are going to write a c program to check whether an input number is prime or not.

Given an integer, Write an efficient c code to check whether a number is prime or not.

## C Program to Print Prime Numbers from 1 to N – Sieve of Eratosthenes

Write a c program to print prime numbers from 1 to N (where n is an integer). This question can also be asked like, print prime numbers from 1 to 100 in c. In this tutorial, we are going to use sieve algorithm to print prime numbers from 1 to N.

Suppose the value of N is 10, So the prime numbers between 1 to 10 is 2, 3, 5, 7.

Now, Let’s learn how to print prime numbers from to 1 to N using Sieve of Eratosthenes. Before solving this program, let’s understand what is a prime number.