Ad Code

Responsive Advertisement

Palindrome number using C program

 

C program to find Palindrome Number

Palindrome using C Program


Palindrome Number:

Palindrome number is the number which is same after reverse.

Example:

121,23432,545 are palindrome numbers.

123,546,7634 are not palindrome numbers.

C Program:

Output 1:

Palindrome number


Output 2:

Palindrome number

From the above program,

ü   let num=5335

 Ã¼ n=num, n=5335


n>0

r=n%10

sum=(sum*10)+r

n=n/10

5335>0

r=5335%10

  =5

sum=(0*10)+5

       =5

n=5335/10

   533

533>0

r=533%10

  =3

sum=(5*10)+3

       =50+3

       =53

n=533/10

  =53

53>0

r=53%10

  =3

Sum=(53*10)+3

       =533

n=53/10

  =5

5>0

r=5%10

  =5

sum=(533*10)+5

      =5335

n=5/10

=0

0>0

false

Doesn’t execute


  Ã¼ after the execution of above table, sum= 5335.

 Ã¼  now it checks the condition sum==num(5335==5335), since the condition is true, it is palindrome number.


 


Post a Comment

0 Comments

Close Menu