Q:

C Program to Check a Number is Palindrome or Not Using While Loop

belongs to collection: Loops C Programs for Practice

0

Write a C Program to Check Whether a Number is Palindrome or Not Using While Loop

 

Logic :

What Is Palindrome ?
"a word, phrase, or sequence that reads the same backwards as forwards"

" Matlab Ulta Seedha Ek Saman "
Simple if string is "12321" compare First '1' to Last '1' same continue repeat if all Number's are shame then Number Is Palindrome .If you understood what is palindrome then try to solve the given problem Check string is palindrome 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#include<stdio.h>
int main()
{
 int n, reverse=0, rem,temp;

 printf("Enter an Integer To Check Number:\n");
 scanf("%d", &n);
  
 temp=n;
   
 while(temp!=0)
 {
  rem=temp%10;
  reverse=reverse*10+rem;
  temp/=10;
 }

   if(reverse==n)
       printf("%d is a Palindrome Number.",n);
   else
       printf("%d is Not a Palindrome Number.",n);
   return 0;
}

 

Output:

Enter An IntegerTo Check Number:

123321

123321 Is a Palindrome Number

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

C Program to Count Number of Digits of a Number (I... >>
<< C Program For Reverse A Number Using While Loop...