Advertisement
Nita_Cristian

Problema -4

Nov 19th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.43 KB | None | 0 0
  1. /// Se da un cuvant format din litere mici sa se verifice un palindrom si sa se afiseze un mesaj corespunzator
  2. #include<iostream>
  3. #include<cstring>
  4.  
  5. using namespace std;
  6.  
  7. char x[256];
  8.  
  9. int main()
  10. {
  11.     cin >> x;;
  12.  
  13.     int lungime = strlen(x);
  14.  
  15.     for(int i = 0; i < lungime/2; i++)
  16.     {
  17.         if(x[i] != x[lungime - i - 1])
  18.         {
  19.             cout << "NU";
  20.             return 0;
  21.         }
  22.     }
  23.  
  24.     cout << "DA";
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement