0 votes
111 views
in C programming by (98.9k points)
edited
Write a program to check whether the enter string is palindrome or not.

1 Answer

0 votes
by (98.9k points)
selected by
 
Best answer
#include<stdio.h>
#include<conio.h>
#include<string.h>
int main(){
    char str[20];
    int i, len, temp=0;
    int flag = 0;
    printf("Enter a string:");
    scanf("%s", str);
    len = strlen(str);
    for(i=0;i < len ;i++){
        if(str[i] != str[len-i-1]){
            temp = 1;
        break;
   }
}
    
    if (temp==0) {
        printf("String is a palindrome");
    }    
    else {
        printf("String is not a palindrome");
    }
    return 0;
}

 

Related questions

0 votes
0 answers 69 views
0 votes
1 answer 135 views
0 votes
1 answer 151 views
0 votes
1 answer 136 views
0 votes
1 answer 111 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

538 users

...