#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:
Previous Next
#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:
Previous Next
I am searching this program
ReplyDelete