#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,k,r,a[50],x;
clrscr();
printf(" Enter Range : ");
scanf("%d",&r);
i=1;
x=0;
while(i<=r)
{
k=0;n=1;
while(n<=i)
{
if(i%n==0)
k++;
n++;
}
if(k==2)
{
a[x]=i;
x++;
}
i++;
}
for(n=0;n<x;n++)
{
if(a[n+1]-a[n]==2)
printf("\n %d and %d are twin prime numbers ",a[n],a[n+1]);
}
getch();
}
#include<conio.h>
void main()
{
int n,i,k,r,a[50],x;
clrscr();
printf(" Enter Range : ");
scanf("%d",&r);
i=1;
x=0;
while(i<=r)
{
k=0;n=1;
while(n<=i)
{
if(i%n==0)
k++;
n++;
}
if(k==2)
{
a[x]=i;
x++;
}
i++;
}
for(n=0;n<x;n++)
{
if(a[n+1]-a[n]==2)
printf("\n %d and %d are twin prime numbers ",a[n],a[n+1]);
}
getch();
}