include
.docx#include<iostream>
#include<math.h>
using namespace std;
int reverse_number(int );
void system(double n)
{
unsigned int celoe, ostatok, rev = 0, kol = 0, ch = 0;
unsigned long d, p;
if (n == 1)
{
p = 1;
d = 9;}
if (n == 2)
{p = 10;
d = 99;}
else
{
p = pow(10,n-1);
d = ((pow(10,n)) - 1);
}
cout << "Диапазон от: " << p << " до: " << d << endl;
for( ;p <= d; p++)
{ int celoe = p, a = 0, i = 0;
while (celoe > 0)
{
ostatok = celoe%16;
if (ostatok <10)
{
ch = ch*10 + ostatok;
}
else
{
ch = ch*100 + ostatok;
}
celoe = celoe/16;
}
rev = reverse_number(ch);
if ( rev == ch)
{ cout << "Число " << p << " в 16-ой сист. счисления" << " = " << ch << endl;
kol++;
}
ostatok = 0;
ch = 0;
}
cout << "Количество = "<< kol << endl;
}
\\\\\\\\
#include<iostream>
using namespace std;
void system(double n);
void main()
{
setlocale(LC_ALL, "rus");
double N;
start:
cout << "Введите N:";
cin >> N; "\n";
if ( N < 1 )
{
cout << N << " < 1";
goto start;
}
if ( N > 9)
{
cout << N << " > 9";
goto start;
}
else
{
system(N);
}
system("PAUSE");
}
\\\\\\
int reverse_number(int number)
{
int n = 0;
while(number)
{
n = 10*n + number%10;
number /= 10;
}
return n;
}