/*Serial No.54 [swami26.cpp]*/
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,num;
clrscr();
printf("Enter the number where u want to stop prime==>");
scanf("%d",&num);
printf("\nYour Prime Numbers till %d are==>",num);
for(i=2;i<=num;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(j==i)
printf("%d\t",i);
}
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int i,j,num;
clrscr();
printf("Enter the number where u want to stop prime==>");
scanf("%d",&num);
printf("\nYour Prime Numbers till %d are==>",num);
for(i=2;i<=num;i++)
{
for(j=2;j<i;j++)
{
if(i%j==0)
break;
}
if(j==i)
printf("%d\t",i);
}
getch();
}
No comments:
Post a Comment
If you have any doubt, feel free to ask...