Prime Numbers From 1 to 100 in C

Prime Numbers From 1 to 100 in C. Program to display prime numbers between two intervals using for loop and if else statement in a c programming language. 

For Loop in C

A for loop is a repetition control structure that lets you design a loop that needs to run a certain number of times quickly. 

In the C programming language, a for loop has the following syntax: The init step is done first and only once. 

Any loop control variables can be declared and initialised at this phase.

Flag Variable in C Program

In a software, flag is used as a signal. Its application is not confined to C programming; it may be used in any code, regardless of language. 

Its function is to regulate the program’s execution and, in some situations, to debug the program. 

A flag is a set of data bits that are used to record binary values as program structural indicators. 

A flag is a data structure element in a computer language.

int main() 
int minimum, maximum, i, flag;
printf("Enter two numbers");
scanf("%d %d", &minimum, &maximum);
printf("Prime Numbers %d and %d are", minimum, maximum);
while (minimum < maximum) 
flag = 0;
if (minimum <= 1) 
for (i = 2; i <= minimum / 2; ++i) 
if (minimum % i == 0) 
flag = 1;
if (flag == 0)
printf("%d ", minimum);


Enter two numbers45
Prime numbers between 45 and 67 are47 53 59 61