Saturday, 26 March 2016

Check Palindrome Number

 

Palindrome :-

Number sequence that reads the same backwards as forwards. If the reversed integer is equal to the integer entered by you then, that number is a palindrome if not that number is not a palindrome.


Checking the given number is palindrome or not:

 
if you want to check this number is palindrome or not "12321".

 #include<stdio.h>
int main()
{
int reverse =0,reminder=0,temp;
int You_entered_number = 12321;
for(temp=You_entered_number ;temp!=0;temp = temp/10)
{
  reminder = temp%10;
  reverse = reverse*10+reminder;
}
 
if(reverse == You_entered_number)
   printf("You entered number is palindrome'%d'", You_entered_number);
else
   printf("You entered number is not palindrome'%d'",You_entered_number);
 
return 0;
}

 

Out Put :-

 
  You entered number is palindrome'12321'.

-----------------------------------------------------------------------------------------
More details about C interview questions and programs: http://learnclanguage4.blogspot.com/

No comments:

Post a Comment

Structure

Defination :-                           Structure is a user defined data type. struct keyword is used to define a structure. Structur...