palindrome between two numbers
#include <stdio.h>
#include <math.h>
int is_Palindrome(int num1, int num2)
{
if (num1 > num2)
{
//printf("base condition\n");
return 0;
}
else
{
if (num1 == reverse(num1))
printf("%d ", num1);
num1 = num1 + 1;
}
is_Palindrome(num1, num2);
}
int reverse(int num1)
{
int dig = (int)log10(num1);
if (num1 == 0)
{
// base condition
return 0;
}
else
return ((num1 % 10 * pow(10, dig)) + reverse(num1 / 10));
}
int main(int argc, char const *argv[])
{
int num1, num2;
printf("enter two numbers:\t");
scanf("%d%d", &num1, &num2);
is_Palindrome(num1, num2);
return 0;
}