C Language Program to Reverse number and check whether the number is palindrome or not by using unconditional statements.

**Palindrome in C:**

A palindrome is a method, which is used to reverse the given numbers. If we reverse a palindrome number, it will not change and it won’t give any other meaning. For example 212, 343, 13431, -525, -767 are palindrome numbers.

For finding a given number is palindrome or not, Initially we have to reverse it, Then compare the given number with the original palindrome number, If both are same then number is palindrome else not.

**Here is a C program for finding a palindrome number. The C source code is given below.**

//Header files

#include <stdio.h>

#include <conio.h>

void main()

{

//Program variables

int cnt,temp,vslue,value1,pow=1,value2=1,sum=0;

clrscr(); //Function to clear the previous output

printf("Enter the number : "); //Display function

scanf("%d",&value); //Getting input function

temp=number;

// method of reverse number

while(value>0) //unconditional statement

{

value/=10;

if(value>0) pow++;

}

Value=temp;

value1=value%10;

while(value>0)

{

value=value/10;

value2=value1*10+sum;

sum=value%10;

}

printf("%d ",value2);

getch();

}

#include <stdio.h>

#include <conio.h>

void main()

{

//Program variables

int cnt,temp,vslue,value1,pow=1,value2=1,sum=0;

clrscr(); //Function to clear the previous output

printf("Enter the number : "); //Display function

scanf("%d",&value); //Getting input function

temp=number;

// method of reverse number

while(value>0) //unconditional statement

{

value/=10;

if(value>0) pow++;

}

Value=temp;

value1=value%10;

while(value>0)

{

value=value/10;

value2=value1*10+sum;

sum=value%10;

}

printf("%d ",value2);

getch();

}

## No comments:

## Post a Comment

Note: only a member of this blog may post a comment.