C program to print Prime Numbers from 1 to 100

In this tutorial you will learn about the C program to print Prime Numbers from 1 to 100 and its application with practical example.

C program to print Prime Numbers from 1 to 100

In this tutorial, we will learn to create a C program that will print Prime Numbers from 1 to 100 using C programming.

Prerequisites

Before starting with this tutorial, we assume that you are the best aware of the following C programming topics:

  • Operators in C Programming.
  • Basic Input and Output function in C Programming.
  • Basic C programming.
  • For loop in C programming.
  • Conditional Statements in C programming.
  • Arithmetic operations in C Programming.

Algorithm:-

Prime Numbers:-

The prime numbers are those numbers that are only divisible by themselves. These numbers can’t be complete, divide by the 2 & 3.

Display Prime Numbers Between 1 and 100:-

In today’s program, we will define the input range to print the prime numbers between them. Then we will find the prime numbers between the range using the for loops and the conditional statements. Now we will print the prime numbers.

With the help of this program, we can Display Prime Numbers Between Two 1 to 100 Using For Loop and conditional statements.

Program Code to print prime numbers:-

 

Output:-

In the above program, we have first initialized the required variable.

  • i = it will hold the integer value of the loop.
  • no = it will hold the integer value of the loop.
  • flag = it will hold the temporary value.

The parent for loop to define the range.

Defining the child loop for the program.

Printing output prime numbers between the range of 1 to 100.

In this tutorial we have learn about the C program to print Prime Numbers from 1 to 100 and its application with practical example. I hope you will like this tutorial.