Algorithm of C program to determine whether the string is palindrome or not
Answers
Answered by
1
Program to Check if a Given String is Palindrome
Given a string, write a c function to check if it is palindrome or not.
A string is said to be palindrome if reverse of the string is same as string. For example, “abba” is palindrome, but “abbc” is not palindrome.
Given a string, write a c function to check if it is palindrome or not.
A string is said to be palindrome if reverse of the string is same as string. For example, “abba” is palindrome, but “abbc” is not palindrome.
chanchal310:
Thanks but i want algorithm
Answered by
5
#include<iostream.h>
#include<conio.h>
#include<string.h>
void main( )
{
char s[100],r[100];
clrscr();
cout<<"Enter the string:";
cin.getline(s,100);
strcpy (r,s);
strrev(r);
if(strcmpi(s,r)==o)
cout<<"It is a palindrome"<<endl;
else
cout<<"It is not palindrom<<endl;
getch();
}
Algorithm:
step1:start
step2: input string
step3:strcpy
step4:strew(string2)
step5:if (stremp(string 1.string 2)=0)
output string 1 is a palindrome
else
output string 1 is not a palindrome
endif
step5:stop
Similar questions