.
Previous Next

Write a C program which checks palindrome string?


/* C program which checks polindrom string */
#include <stdio.h>
#include<conio.h>
#include <string.h>

int main(){
    char str[100];
    char rev[100];
    int i,j;
    clrscr();
    printf("Enter String : ");
    scanf("%s",str);
    i = 0; j = strlen(str)-1;
    while(j>=0){
  rev[i] = str[j];
  i++;j--;
    }
    rev[i] = '\0';
    if(strcmp(rev,str) == 0){
  printf("%s is polindrom",str);
    }
    else{
  printf("%s is not polindrom",str);
    }
    getch();
    return 0;
}

Previous Next