81. WAP to program to print first [x] prime number starting from [n]
#include<stdio.h>
void
main()
{
int i,j,c,n1,n2,p;
printf("WAP to program to print
first [x] prime number starting from [n] \n");
printf("Enter the starting number
: ");
scanf("%d",&n1);
printf("Enter how many prime
numbers you want : ");
scanf("%d",&n2);
for(i=n1,p=0;p<n2;i++)
{
for(j=2,c=0;j<i;j++)
{
if(i%j==0)
c++;
}
if(c==0)
{
printf("%d
",i);
p++;
}
}
printf("\n");
}
Comments
Post a Comment