Answers for "string palindrome program in c using for loop"

C
0

palindrome in c using function

#include <stdio.h>
#include <conio.h>

int palindrome (int num);

void main()
{
    int n, ret;
    printf("Enter the number: ");
    scanf("%d",&n);

    ret = palindrome(n);

    if (ret == n)
        printf("\nPalindrome\n");
    else
        printf("\nNot Palindrome\n");
}

int palindrome(int num)
{
    int rem, rev=0;

    while (num!=0)
    {
        rem = num % 10;
        rev = rev * 10 + rem;
        num /= 10;
    }

    return rev;
}
Posted by: Guest on June-23-2021

Code answers related to "string palindrome program in c using for loop"

Code answers related to "C"

Browse Popular Code Answers by Language