/*****************<soeasyprograms.blogspot.in>******************/
/*Program to print all prime numbers upto n*/
#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
clrscr();
scanf("%d",&n);
for(i=2;i<=n;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(i==j)
{
printf("\n %d ",i);
}
}
getch();
}
/*End of program*/
/*****************<soeasyprograms.blogspot.in>******************/
No comments:
Post a Comment