Results 1 to 1 of 1

Thread: C program for palindrome strings

  1. #1

    C program for palindrome strings

    Code of Palindrome String is my first coding in my BCA academic first year.

    So I just want to copy this code and write same for you all as it is in C program. After writing this code when you execute then it will ask you "Enter the string to check if it is a palindrome" the program will run the code and it will display the output if it is palindrome string it will display "You have entered palindrome string" or else it will display.

    The entered string is not a palindrome".

    Code:
    #include <stdio.h>;
    #include <string.h>;
    
    int main()
    {
    char a[100], b[100];
    
    printf("Enter the string to check if it is a palindrome\n");
    gets(a);
    strcpy(b,a);
    strrev(b);
    if (strcmp(a,b) == 0)
    
    printf("You have entered palindrome string.\n");
    else
    
    printf("The entered string is not a palindrome\n");
    return 0;
    }
    Last edited by Jack Phillips; 06-21-2016 at 11:02 AM.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •