Skip to main content

PROGRAM TO CHECK WHETHER A NO. IS PALINDROME OR NOT


#include<stdio.h>
#include<conio.h>
void main()
{
long int n,r=0,n2=0;

clrscr();

printf("enter a number");

scanf("%ld",&n);

if(n<0)
printf("WRONG INPUT");

else
{

while(n>0)
{

r=n%10;
n2=n2*10+r;
n=n/10;

}

if(n==n2)
printf("PALINDROME");

else
printf("NOT A PALINDROME");

}

getch();

}

SIMPLE PROGRAMS
FUNCTIONS


NUMBERS


STRINGS AND CHARACTERS

Comments

Popular posts from this blog

unix commands