Two Number Between prime Number in C Programming

#include<stdio.h>
#include<conio.h>
void main()
{
int i,u,x,j;
clrscr();
printf("enter two number");
scanf("%d %d",&j,&u);
for(x=j;x<=u;x++)
{
for(i=2;i<=x;i++)
   {
if(i%x==0)
break;
   }
   if(x/i==1);
   {
printf("%d",x);
   }
}
getch();

}

2.\\ Prime number in C Programming ..

#include<stdio.h>
#include<conio.h>
prime(int n,int i);
void main()
{
int n,a;
clrscr();
printf("number of i:");
scanf("%d",&n);
a=prime(n);
printf("prime=%d",n);
getch();
}
prime(int n,int i)
{
for(i=2;n>1;n++);
{
while(n%i==0)
{
printf("%d",i);
n=n/i;
}
return(prime);
}
}

Post a Comment

0 Comments