C Program to print prime numbers between 1 to 100

#include<stdio.h>
#include<conio.h>
int main(){
int number,i,flag;
printf(" The prime numbers between 1 and 100 : \n");
for(number=2;number<=100;++number)
{
flag=0;
for(i=2;i<=number/2;i++){
if((number % i) == 0){
flag++;
break;
}
}
if(flag==0)
printf("\n    %d ",number);
 }
return 0;
getch();
}

Output:

1 comment:

100 C Programs with Code and Output

Program 1: C Program To Read Two Numbers And Print The Sum Of Given Two Numbers. Program 2: C Program To Read Three Numbers And Prin...