C Program to print prime numbers up to a given number.

Hey there!

Welcome to ClearUrDoubt.com.

I would recommend you to go through the below post before you continue with this.

C Program to find whether a number is a prime number or not.

In this post, we will look at a C program to print the prime numbers up to a given number.

This can be achieved using any of the below iterative statements in C.

do-while loop
while loop
for loop

We will use the for loop and print the prime numbers:

Here is the C program:

 

Output:


 

 

 

 

Happy Learning! 🙂

Please leave a reply in case of any queries.

Leave a Reply

Your email address will not be published.