A PHP Error was encountered

Severity: 8192

Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated

Filename: libraries/Filtered_db.php

Line Number: 23

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

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

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)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now