#include <iostream>
long prodDigitExcept_2_9(int N) {
long prod = 1;
bool haveNeedDigit = false;
while (N > 0) {
int temp = N % 10;
if (temp != 2 and temp != 9) {
prod *= temp;
haveNeedDigit = true;
}
N /= 10;
}
if (haveNeedDigit)
return prod;
return -1;
}
long prodDigit(int N) {
long prod = 1;
while (N > 0) {
prod *= N % 10;
N /= 10;
}
return prod;
}
signed main() {
setlocale(LC_ALL, "Rus");
int N;
std::cin >> N;
long result = prodDigit(N);
if (result == -1)
std::cout << "В данном числе нет подходящих цифр!";
else
std::cout << result;
return 0;
}
Python 3.9
Объяснение:
c, d = map(int, input("Input c d: ").split())
a=int(c/c)
b=int(d/c)
dem=int(d/c)
if c*d<2000000000:
if d%c==0:
print(a*c, b*c)
for i in range(dem):
b=int(d/c)
for j in range(dem,0,-1):
if a<=b:
if a*b==dem:
if b%a!=0:
print(a*c, b*c)
b=b-1
else:
break
a=a+1
else:
print("Пара не существует")
#include <iostream>
using namespace std;
int main() {
setlocale(LC_ALL, "Russian");
int N, y, i;
bool Prime;
cout << "Введите число: "; cin >> N;
do {
Prime = true;
y = N % 10;
for (i = 2; i <= (sqrt(abs(y))); i++) {
if (y % i == 0) {
Prime = false;
break;
}
}
if ((Prime) & (y != 0) & (y != 1))
cout << y << " - простое" << endl;
else
cout << y << " - не простое" << endl;
N = N / 10;
} while (N != 0);
system("pause");
return 0;
}