// Program of Palindrome
#include
#include
#include
void main()
{
clrscr();
char string[25], revstring[25] = {'\0'};
int i,length=0;int flag=0;
printf("Enter the string\n");
gets(string);
for(i=0;string[i]!='\0';i++)
{
length++;
}
for(i=length-1;i>=0;i--)
{
revstring[length-1] = string[i];
}
{
if(revstring[i]==string[i])
flag=1;
else
flag=0;
}
if(flag==1)
{
printf("%s is not a palindrome\n", string);
}
else
{
printf("%s is a palindrome\n", string);
}
getch();
}
· Start
· Declare string[25], revstring[25] = {'\0'} as character
· Declare i, length=0; flag=0 as integer
· Write("the string")
· gets(string)
· for(i=0;string[i]!='\0';i++)
· length++
· for(i=length-1;i>=0;i--)
· revstring[length-1] = string[i]
· if(revstring[i]==string[i])
· flag=1
· else
· flag=0
· if(flag==1)
· Read(“It is not a palindrome”)
· else
· Read("It is a palindrome")
· Stop
c language example programs
ReplyDeletec program code Print ip addresses found in text