-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In this i have tried character array.
- Loading branch information
1 parent
5c7edff
commit bad0d44
Showing
3 changed files
with
28 additions
and
0 deletions.
There are no files selected for viewing
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
// In this we will see whether a string is palindrome is string or not | ||
|
||
#include <bits/stdc++.h> | ||
using namespace std; | ||
int main() | ||
{ | ||
int n; | ||
cin >> n; | ||
char array[n+1]; | ||
cin >> array ; | ||
int flag=0; | ||
for(int j=0; j<n ; j++) | ||
{ | ||
if(array[j]!=array[n-1-j]) | ||
{ | ||
flag=1; | ||
break; | ||
} | ||
} | ||
|
||
if(flag==1){ | ||
cout << "Not Palnidrome\n"; | ||
} | ||
else | ||
{ | ||
cout << "Palindrome\n" ; | ||
} | ||
} |
Binary file not shown.