#include #include void getString(char *str){ fgets(str, 100, stdin); } int checkDoiXung(char *array){ int i, temp; int count = 0; if((strlen(array) - 1) % 2 == 0){ temp = (strlen(array) - 1) - 1; for(i = 0; i < (strlen(array) - 1) / 2; i++){ if(array[0 + i] == array[temp - i]){ count++; } } } else{ temp = (strlen(array) - 1) / 2; for(i = 0; i < temp;){ i++; if(array[temp - i] == array[temp + i]){ count++; } } } if(count == (strlen(array) - 1) / 2){ return 1; } else{ return 0; } } int main(){ char str[100]; printf("input String: "); getString(str); if(checkDoiXung(str)){ printf("\nString symmetric!"); } else{ printf("\nString not symmetric!"); } return 0; }