C
Programming and Technical
Programming
Output
Write a program to print the nth prime number after a given number m.
Example 1: Given prime number m=3 and n=5. The program should print the 5th prime number afer 3
Given input
3
5
Expected output
17
Read Solution (Total 5)
-
- #include
main()
{
int i,a,b,c;
printf("enter start prime numbern");
scanf("%d",&a);
printf("enter which location the prime number to printn");
scanf("%d",&b);
for(i=1;i - 9 years agoHelpfull: Yes(15) No(11)
- #include
#include
void main()
{
clrscr();
int i,j,k=0,m=3,n=5,flag=1;
for(i=m+1;;i++)
{
for(j=i-1;j>1;j--)
{
if(i%j==0)
{
flag=0;
break;
}
if(flag==1)
{
k++;
if(k==n)
{
printf("%d",i);
goto a;
}
}
else
flag=1;
}
}
a:getch();
}
- 9 years agoHelpfull: Yes(4) No(7)
- //m=3 n=5
void main()
{
int i=0,c=0,j=1;
m=m+1;
while(i - 9 years agoHelpfull: Yes(1) No(6)
- void main(){
int m,n,k=0,i=2,ctr=0;
clrscr();
printf("n Enter m and n and m must be prime");
scanf("%d%d",&m, &n);
x=m;
while(i - 9 years agoHelpfull: Yes(1) No(3)
- //m=3 n=5
void main()
{
int i=0,c=0,j=0;
m=m+1;
while(i - 9 years agoHelpfull: Yes(0) No(6)
C Other Question