Pages

Friday 1 February 2019

PROGRAM TO FIND WHETHER THE GIVEN NUMBER IS PALINDROME OR NOT

PROGRAM TO CHECK THE GIVEN NUMBER IS PALINDROME OR NOT

// prg to illustrate given number is palindrome or not
#include<stdio.h>
void main()
{
 int n,r,rev=0,temp;
 printf("enter any number:");
 scanf("%d",&n);
 temp=n;
 while(n != 0)
  {
   r = n % 10;
   n = n / 10;
   rev=rev *10 +r;
  }
  if( temp == rev )
   printf("%d  is a palandrome \n",temp);
  else
   printf("%d  is not a palandrome \n",temp);
}   


output:


No comments:

Post a Comment

Programs in turboc3 : Files

File Handling in C File Handling concept in C language is used for store a data permanently in computer. Using this concept we can store our...