Computer Science, asked by sahilmalik70, 22 hours ago

please can someone give me the of this c++ question​

Attachments:

Answers

Answered by samarthkrv
1

Answer:

#include <bits/stdc++.h>

#include <iostream>

using namespace std;

bool isPalindrome(string str){

   int len = str.length();

   string rev;

       for(int i = len-1; i >= 0; i--){

           rev.push_back(str[i]);

       }

   if (rev == str){

       return true;

   }

   return false;

}

int main() {

   char str[100];

   cout << "Enter a string:";

   cin >> str;

       if(isPalindrome(str)){

           cout << str << " is a palindrome \n";

       }

       else{

           cout << str << " is not a palindrome \n";

       }

}

Explanation:

Similar questions