String Palindrome

What is the compilation error in this code?

#include <bits/stdc++.h>

using namespace std;
int main()
{
string stri ;
int n;
getline (cin, stri) ;
n = stri.size();
for (int i=0;i<n/2;i++)
{
if (stri[i]==stri[n-1-i]);
{
int flag=1;
}
else flag =0;
}

if (flag==1)

{
cout<<“PLAINDROME”;
}
return 0;
}

@arc21hit Hey Archit, Semicolon Here : if (stri[i]==stri[n-1-i]);
and flag is not declared.

On the off chance, you still have some questions or not find the answers satisfactory then I will happy to help you out.

1 Like

@arc21hit Hey Archit, I hope I’ve cleared your doubt. Please mark this doubt as resolved and rate me on the basis of your experience. Rating option is just below where you mark this doubt as resolve. Your feedback is very important. It helps us to improve our platform and hence provide you the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen the doubt.

Resolve button is under the unresolved section.