Program
#include<stdio.h>
#include<conio.h>
void main()
{
int n, rev, m, i;
clrscr();
printf("Enter a Number : ");
scanf("%d", &n);
for(i=1; i<=n; i++)
{
rev=0;
m=i;
while(m>0)
{
rev=(rev*10)+(m%10);
m=m/10;
}
if(rev==i)
printf("\t%d", i);
}
getch();
}
Output:
Enter a Number : 100
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99,
Enter a Number : 200
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 11, 22, 33, 44, 55, 66, 77, 88, 99, 101, 111, 121, 131, 141, 151, 161, 171, 181, 191,
No comments:
Post a Comment