Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
350 views
in Functions by (30.4k points)
closed by

Write a program to check whether a string is palindrome or not. (A string is said to be palindrome if it is the same as the string constituted by reversing the characters of the original string.

Eg. “MALAYALAM”, “MADAM”, “ARORA”, “DAD”, etc. .

1 Answer

+1 vote
by (30.5k points)
selected by
 
Best answer

# include<iostream>

using namespace std;

int main()

{

char str[40];

int len,i,j;

cout<<” Enter a string”; 

cout<<str;

for(len=0;str(len)!='\0'/;len++)

for(i=0;j=len-1;i<len/2;i++,j--)

if(str[i]!=str[j])

break;

if(i==len/2)

cout<<str<<"is palindrome";

else

cout<<str<<"is not palindrome";

}

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...