Нужна составьте блок схемуprogram n_18; varn,sum,q: integer; beginwrite (' n = '); readln (n); writeln; q: = 0; sum: =0while n> 0 dobegininc (q); sum: = sum + n mod 10n: = n div 10end.writeln ('количество цифр: ' , q); writeln (' сумма цифр: 'sum); end.
#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;
}