ThoughtWorks
Programming and Technical
Programming
Program
Print prime palindromes in a given range of number.
eg. 101
Read Solution (Total 6)
-
- #include
#include
void main()
{
clrscr();
int n,i,j,flag=0,rem,rev=0,k,num;
printf("Enter range");
scanf("%d",&n);
for(i=2;i0)
{
rem=num%10;
rev=rev*10+rem;
num=num/10;
}
if(rev==j)
{
for(k=2;k - 10 years agoHelpfull: Yes(2) No(0)
- The following code work for range
- 10 years agoHelpfull: Yes(0) No(0)
- #include
#include
#include
#define n 1000000
int arr[n]={0};
int poly(int x){
int dup = x, a=0;
while(x){
a = a*10+x%10;
x = x/10;
}
if(dup==a)
return 1;
return 0;
}
// Generate prime number using Sieve of Eratosthenes
void solve(){
arr[0] = 1;
arr[1] = 1;
int i, j;
for(i=2;i - 10 years agoHelpfull: Yes(0) No(0)
- static void printPP(int n)
{
int i,x,r,rev,j,f=0;
for(i=1;i - 9 years agoHelpfull: Yes(0) No(0)
- static void printPP(int n)
{
int i,x,r,rev,j,f=0;
for(i=1;i - 9 years agoHelpfull: Yes(0) No(0)
- java interpretation
static void printPP(int n)
{
int i,x,r,rev,j,f=0;
for(i=1;i - 9 years agoHelpfull: Yes(0) No(0)
ThoughtWorks Other Question