Thursday, 11 September 2014

Palindrome Program in C Language with Example

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
    // method of reverse number
    while(value>0//unconditional statement
        if(value>0) pow++;
    printf("%d ",value2);

No comments:

Post a comment

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