#include <iostream>
#include <string>
#include <algorithm>
bool P(int value)
{
std::string left = std::to_string(value);
std::reverse(left.begin(), left.end());
std::string right = std::to_string(value);;
return left == right;
}
int main()
{
int n;
std::cin >> n;
int count = 0;
for (int i = 1; i <= n; ++i)
{
if (P(i))
{
count++;
}
}
std::cout << "Count palindrome: " << count << std::endl;
return 0;
}
var j, a, b, n: integer;
label 1;
begin
1: randomize;
a: = random (9);
b: = random (9);
write (a, '*', b, '=');
read (n);
if n = (a * b) then writeln ('відповідь вірний! ')
else writeln ('відповідь неправильний! ');
writeln ('продовжуватимеш? ');
writeln ('якщо так то натисни 1');
writeln ('якщо немає то натисни 2');
read (j);
if j = 1 then goto 1;
if j = 2 then writeln ('до побачення! ');
end.
начебто так, точно не пам'ятаю.
Поделитесь своими знаниями, ответьте на вопрос: