Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Используя цикл while определить, является ли введенное число палиндромом.
- #include <iostream>
- using std::cout;
- using std::cin;
- using std::endl;
- void main()
- {
- setlocale(LC_ALL, "Russian");
- int a, b = 0, cntnr;
- cout << "Введите число: "; cin >> a;
- cntnr = a;
- while (cntnr != 0)
- {
- b = b * 10 + cntnr % 10;
- cntnr /= 10;
- }
- if (a == b)
- cout << a << " является палиндромом" << endl;
- else
- cout << a << " не является палиндромом" << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement