- WAP a program in C to print first 5 Prime Palindriome.
#include <conio.h>
void main()
{
int a=1,b=1,c=1,f,s,count;
while(c>=5)
{
s=a+b;
count=2;
for(f=2;f<=s/2;f++)
{
if(s%f==0)
{
count++;
break;
}
if(count==2)
{
printf("%d ",s);
c++;
}
a=b;
b=s;
}
}
getch();
}
No comments:
Post a Comment