Palindrome Number Series from 1 to 500 - C Program

Palindrome Number Series from 1 to 500

 #include<stdio.h>
int main()
{
    int num, n, rev_no, r;
    printf("Palindrome Number from 1 to 500\n");
    for (num = 1; num <= 500; num++)
    {
        rev_no = 0;
        n = num;
        while (n != 0)
        {
            r = n % 10;
            rev_no = rev_no * 10 + r;
            n = n / 10;
        }
        if (num == rev_no)
            printf("%d ",num);
    }
    return 0;
}

Output - Palindrome Number Series from 1 to 500

Palindrome Number from 1 to 500                                                                                       
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 202 212 222 232 242 252 262 272 2
82 292 303 313 323 333 343 353 363 373 383 393 404 414 424 434 444 454 464 474 484 494  
Compile and Run Online