Tuesday 18 April 2017

Example of Palindrome number in C

Dear Students ,

Q.   Do you know ? What is Palindrome number ?

Ans . If yes , then good otherwise no worry .

Let's See . What is Palindrome number .



Palindrome Numbers are those number which we could read from any side either left or right but value are same .

Example :

     num=123454321

Let's see example with program.

            #include<stdio.h>
           #include<conio.h>

            void main()
            {
                   int num,temp,rem,sum=0;

                     printf("Enter your Number : ");
                      scanf("%d",&num);

                     temp=num;
                     while(num>0)
                      {
                             rem=num%10;
                             sum=sum*10+rem;
                             num=num/10;
                   }
                    if(sum==temp)
                      {
                         printf("Number is Palindrome ");
                        }
                      else
                          {
                            printf("Number is not Palindrome ");
                          }
                            getch();
            }


1 comment: