#include <iostream>
using namespace std;
int a, b, numb;
bool init;
int main()
{
do {
cout << "Input a b: ";
cin >> a >> b;
if ((a > b) || (a <= 0) || (b <= 0))
cout << "Input error! Try again" << endl;
} while ((a > b) || (a <= 0) || (b <= 0));
for (int i = a; i <= b; i++) {
init = true;
numb = i;
do {
if (numb % 10 == 0)
init = false;
else if ((i / (numb % 10) * (numb % 10)) != i)
init = false;
numb /= 10;
} while (numb != 0);
if (init == true)
cout << i << " ";
}
return 0;
}
ответ:50153
Объяснение:
s = 0
c = 0
for i in range(10000, 1321231231231):
delit = []
for j in range(2, i//2+1):
if i % j == 0:
delit.append(j)
if len(delit) == 0:
c += 1
s += i
if c == 5:
break
print(s)