void palindrome(int s,int e)
{
int r,d;
while(s<=e)
{
r=0;
d=s;
while(1)
{
r+=d%10;
d/=10;
if(d>0)
r*=10;
else
break;
}
if(s==r)
printf(" %d",s);
s++;
}
}
void main()
{
int n;
clrscr();
printf("\nEnter the limit N (more than 11): ");
scanf("%d",&n);
puts("\n");
palindrome(10,n);
getch();
}
Algorithm
palindrom()
step1: start
step2: check whether s<=0,then go to step 3
else go to step 15
step3: r=0
step4: d=s
step5: r=r+d%10
step6: d=d/10
step7: check whether d>0 then go to step8
else go to step 9
step8: r=r*10
step9: break
step10: go to step 5
step11: check whether s=r,then go to step 12
else go to step 13
step12: print s
step13: s=s+1
step14: go to step 2
step15:stop
main()
step1: start
step2: read n
step3: call palindrome(10,n)
step4: stop
{
int r,d;
while(s<=e)
{
r=0;
d=s;
while(1)
{
r+=d%10;
d/=10;
if(d>0)
r*=10;
else
break;
}
if(s==r)
printf(" %d",s);
s++;
}
}
void main()
{
int n;
clrscr();
printf("\nEnter the limit N (more than 11): ");
scanf("%d",&n);
puts("\n");
palindrome(10,n);
getch();
}
Algorithm
palindrom()
step1: start
step2: check whether s<=0,then go to step 3
else go to step 15
step3: r=0
step4: d=s
step5: r=r+d%10
step6: d=d/10
step7: check whether d>0 then go to step8
else go to step 9
step8: r=r*10
step9: break
step10: go to step 5
step11: check whether s=r,then go to step 12
else go to step 13
step12: print s
step13: s=s+1
step14: go to step 2
step15:stop
main()
step1: start
step2: read n
step3: call palindrome(10,n)
step4: stop