In this tutorial, we are going to write a program in C to print the first N Prime Number. Basically, on the basis of the given input, our program will print the Prime Number.
For example, if we want to print the first 5 prime numbers, Our program will take 5 as an input and it will print 2,3,5,7,11 as an output.
What is Prime number?
A prime number is a number that can only divide by 1 and the number itself.
for example, 2, 3, 5 etc are the prime number. Here 2 and 3 can only be divided by 1 and number itself.
But 4 or 6 is not a prime number because 4 can be divided by 2 and 6 can be divided by 2 and 3.
Let’s see the program in C
C Program to Print first n Prime Number
Output
[wpusb]