How to write a program to check palindrome using do while?

CODE




How to write a program to check palindrome using do while?

int main()
{
    int n,r,rev=0,n1;
    printf("\n enter the number:");
    scanf("%d",&n);
    n1=n;
    do
    {
        r=n%10;
        rev=rev*10+r;
        n=n/10;
    }while(n!=0);
    if(rev==n1)
        printf("\n Palindrome");
    else
        printf("\n Not palindrome");
}


Output:
enter the number: 40

 Not palindrome

How to write a program to check palindrome using do while? How to write a program to check palindrome using do while? 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.