The meaning of the problem is such that 2 figures are taken from the number (1 and last) and compared. Screenshot is a working program on python. That's about what I myself tried to write in C ++, but the program does not work. Python program

#include <iostream> using namespace std; #includ <conio.h> int main() { int n, a; cin >> n; { int a = n % 10; } while (n // 10 != 0) { n = n // 10; } if (a == n) { cout << "YES, n" << endl; } else { cout "No" << endl; } return 0; } 
  • 3
    // - these are Python troubles :), in C ++ just / - Harry
  • Please do not change the code in the question, when it significantly affects the answers. Otherwise it looks like some idiocy) You wrote the correct code, you were prompted about something strange. - pavel

1 answer 1

In C ++, the division of two integers is performed completely. as in Python // .

In order to get the division is not complete, at least one of the operands must be converted to a floating point type:

 5/4 -> 1 double(5)/4 -> 1.25 

So just use / , and get tired of what in C ++ // means the beginning of a single-line (until the end of the line) comment.