Вопрос задан 10.09.2018 в 07:25. Предмет Информатика. Спрашивает Амангелді Алматбек.

Составить программу, которая подсчитывает общее количество целых пятизначных чисел, составленных из

различных цифр, которые обладают тем свойством, что число, образованное первыми двумя цифрами, будучи умноженным на среднюю цифру, даёт число, образованное последними двумя цифрами.Например, число: 12896: 12*8=96, значит число подходит.
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Martynova Diana.
Var
  i, n, a, b, c: longint;

begin
  n := 0;
  for i := 10000 to 99999 do
  begin
    a := i div 1000;
    b := (i div 100) mod 10;
    c := i mod 100;
    if a * b = c then n := n + 1
  end;
  Writeln('Найдено чисел: ', n)
end.

Результат работы программы:

Найдено чисел: 286


0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to Count Five-Digit Numbers with a Specific Property

Here is a program in Python that counts the total number of five-digit numbers, composed of distinct digits, which have the property that the number formed by the first two digits, when multiplied by the middle digit, equals the number formed by the last two digits.

```python count = 0

for num in range(10000, 100000): digits = [int(d) for d in str(num)] if len(set(digits)) == 5 and digits[0] * digits[1] == digits[3] * digits[4]: count += 1

print("Total count:", count) ```

Explanation: - The program uses a `for` loop to iterate through all five-digit numbers, starting from 10000 and ending at 99999. - For each number, the program converts it into a list of digits using a list comprehension. - It then checks if the number has distinct digits by converting the list to a set and comparing the lengths. - Finally, it checks if the product of the first two digits is equal to the product of the last two digits. - If the number satisfies both conditions, the count is incremented. - After the loop, the program prints the total count of numbers that meet the criteria.

Please note that running this program may take some time due to the large number of iterations involved.

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос