Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main() {
- int n, a, c =10, flag = 1, size = 0;
- cin >> n;
- while(n / c != 0) {
- size++;
- c *= 10;
- }
- for(int i = 1; i <= size; i++) {
- c = int(pow(10, i));
- a = int(pow(10, size - i));
- if((n / c) % 10 != (n / a) % 10) {
- flag = 0;
- }
- }
- if(flag == 1) {
- cout << "YES";
- }
- else {
- cout << "NO";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement