# Thread: Print first N palindrome numbers

1. ## Print first N palindrome numbers

Hello, I have this program:

Code:
```#include <stdio.h>

int main()
{
int N, i, j, reversedNumber, currentNumber, remainder;

printf("Give N numbers: ");
scanf("%d", &N);

for (i = 0; i <= N; i++)
{
for (j = 0; j <= i; j++)
{
remainder = currentNumber % 10;
currentNumber = currentNumber / 10;
reversedNumber = reversedNumber * 10 + remainder;
}

if (reversedNumber == N)
{
printf("%d", N);
i++;
}
}
return 0;
}```
What I am trying to do is to make it print the first n palindrome numbers(not until n but the first n numbers). The problem is that the program exists and it doesn't print nothing. Any suggestion?

2. Put aside this program and instead write a program that prints "yes" if the number input is a palindrome number and "no" otherwise. Show us this program.

The idea is that first you need confidence to know that your palindrome number testing is working correctly. Then, you can more confidently identify and debug the logic error in your current program because you can rule out an issue with the palindrome number testing.

Code:
```#include <stdio.h>

int main()
{
int N, reverse = 0, rem, N1;

printf("Enter an integer: ");
scanf("%d", &N);
N1 = N;

while (N != 0)
{
rem = N % 10;
reverse = reverse * 10 + rem;
N /= 10;
}

if (N1 == reverse)
printf("%d palindrome", N1);
else
printf("%d not palindrome", N1);
return 0;
}```
What I found out is that in order to check the number I have to save it in another variable and do the check with that variable not the N itself because I always get 0 as return. Which if I am right it happens from the calculations made inside the while. Other than that I couldn't find something else