CONCEPT:
cp=checking palindrome
rcp= reverse checking palindrome
using strcpy copy co to rcp and then reverse it using strrev() and check in IF() condition if condition is true ==1 and for false condition ==0;,
can be used for numbers and characters both.
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#include<string.h>
void main()
{
char cp[50],rcp[50];
clrscr();
printf("enter any string\n");
scanf("%s",cp);
strcpy(rcp,cp);
strrev(rcp);
if(strcmp(cp,rcp)==0)
{
printf("palindrome");
}
else
{
printf("not a palindrome");
}
getch();
}
Well done!
Aww yeah, you successfully read this important program. This program will help you to concepts of palindrome.
and some string handling functions.
0 Comments
if you have any doubt, plz let me know