#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,count,j;
clrscr();
printf("enter the number:");
scanf("%d",&n);
printf("the prime number below%d are:",n);
for(i=1;i<=n;i++)
{
count=0;
for(j=1;j<=i;j++)
if(i%j==0)
count++;
if(count==2)
printf("\t%d",i);
}
getch();
}
#include<conio.h>
void main()
{
int n,i,count,j;
clrscr();
printf("enter the number:");
scanf("%d",&n);
printf("the prime number below%d are:",n);
for(i=1;i<=n;i++)
{
count=0;
for(j=1;j<=i;j++)
if(i%j==0)
count++;
if(count==2)
printf("\t%d",i);
}
getch();
}
No comments:
Post a Comment