Palindrome using string function: Palindrome String means that string spelled as same as in reverse. that is considering we have a string name now reverse that string if reversed string matches with the original string then that string is referred to as palindrome string.

Example :
Ankit is not a palindrome
ABA is palindrome
In the above example, Ankit => reverse string we get tikna as a string which is different from the original string so it’s not a palindrome. Similarly ABA => reverse string we get ABA which is the same as an original string so its palindrome string.

Algorithm for palindrome string

  1. Take string input
  2. Find the length of the string
  3. Traverse string from start to end
    compare character from start and end
    If they are not equal
    Set flag=1
  4. if flag==1
    Print string is not a palindrome
    Print string is not a palindrome

Flowchart for palindrome string

Palindrome string flowchart
Palindrome string flowchart

C program for Palindrome using string function

#include <stdio.h>
#include <string.h>

int main(){
char string1[20];
int i, length;
int flag = 0;

printf("Enter a string:");
scanf("%s", string1);

length = strlen(string1);

for(i=0;i < length ;i++){
if(string1[i] != string1[length-i-1]){
flag = 1;

if (flag) {
printf("%s is not a palindrome", string1);
else {
printf("%s is a palindrome", string1);
return 0;


Palindrome using string function

Write A Comment