#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;
}
#include <iostream>
using namespace std;
int main(){
int n = 0;
cout << "Введіть розмірність матриці n*n: ";
cin >> n;
int A[n][n];
for(int i = 0; i<n; i++){
for(int j = 0; j<n; j++){
cout << "Введіть А[" << i << "][" << j << "]: ";
cin >> A[i][j];
}
}
int sum = 0;
cout << "\n\nМатриця:\n";
for(int i = 0; i<n; i++){
for(int j = 0; j<n; j++){
cout << A[i][j] << " ";
if(A[i][j]%2 != 0) sum+=A[i][j];
}
cout << endl;
}
cout << "\n\nСума: " << sum;
cout << endl;
return 0;
}