How to make a program to print and count Palindrome numbers in 11 to N ?

CODE




How to make a program to print and count Palindrome numbers in 11 to N ?
int main()
{
    int n,rev=0,j,i=11,n1,r,count=0;
    printf("\n enter the value of n:");
    scanf("%d",&n);
    n1=n;
    while(i<=n1)
    {
        j=i;
        rev=0;
        while(j!=0)
        {
            r=j%10;
            rev=rev*10+r;
            j=j/10;
        }
        if(rev==i)
        {
            printf("\n palindrome=%d",rev);
            count++;
        }
        i++;
    }
    printf("\n number of palindrome=%d",count);
}

Output:
enter the value of n: 40

 palindrome=11
 palindrome=22
 palindrome=33
 number of palindrome=3

How to make a program to print and count Palindrome numbers in 11 to N ? How to make a program to print and count Palindrome numbers in 11 to N ? Reviewed by Unknown on December 16, 2018 Rating: 5

No comments:

If you have any doubt or query ,comment below:

Programming copyright © 2018-19. Powered by Blogger.