You're online now.

Hurray! you are online now.

Check Palindrome Number in c

A palindrome number is palindrome number is after reverse number is same.
For Example: 17671 is reversed also same 17671. So this number is palindrome.

// Check whether a given number is palindrome or not in c programming.
    #include<stdio.h>
    
    int main()
    {
        int n;
        printf("Enter the number do you want to check palindrome or not : ");
        scanf("%d", &n);
        int temp = n;
        int rev = 0, last_digit;
        
        while(n>0){
            last_digit = n % 10;
            rev = rev * 10 + last_digit;
            n = n / 10;
        }
        
        if(temp==rev){
           printf("%d is Palindrome", temp);
        }else{
           printf("%d is Not Palindrome", temp);
        }
         return 0;
    }
🖤 0
Buy me coffee ☕

Comments

Oops!

No comments here...