Есть ответ 👍

Напишите программу которая считает произведение цифр введенного натурального числа..

103
315
Посмотреть ответы 2

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


Var   n, p: integer; begin   write('число: ');   readln(n);   p : = 1;   while n > 0 do   begin       p : = p * (n mod 10);       n : = n div 10   end;   writeln('произведение цифр = ', p); end. тест №1 число: 54321 произведение цифр = 120 тест №2 число: 54320 произведение цифр = 0

Sub ()dim a(1 to 4, 1 to 4) as integerdim b(1 to 3, 1 to 3) as integerrandomizefor i = 1 to 4    for j = 1 to 4        a(i, j) = int((10 * rnd) + 1)        cells(i, j) = a(i, j)    next jnext ifor i = 1 to 3    for j = 1 to 3        b(i, j) = int((10 * rnd) + 1)        cells(i + 5, j) = b(i, j)    next jnext icall obrabotkaa(a)call obrabotkab(b)call result(a, b)end subsub obrabotkaa(a)collumnmax = 0collumnmin = 0summmax = 0summmin = 999for j = 1 to 4summ = 0    for i = 1 to 4        summ = summ + a(i, j)    next i    if summ > summmax then        summmax = summ        collumnmax = j    end if    if summ < summmin then        summmin = summ        collumnmin = j    end ifnext jfor i = 1 to 4    temp = a(i, collumnmax)    a(i, collumnmax) = a(i, collumnmin)    a(i, collumnmin) = tempnext iend subsub obrabotkab(b)collumnmax = 0collumnmin = 0summmax = 0summmin = 999for j = 1 to 3summ = 0    for i = 1 to 3        summ = summ + b(i, j)    next i    if summ > summmax then        summmax = summ        collumnmax = j    end if    if summ < summmin then        summmin = summ        collumnmin = j    end ifnext jfor i = 1 to 3    temp = b(i, collumnmax)    b(i, collumnmax) = b(i, collumnmin)    b(i, collumnmin) = tempnext iend subsub result(a, b)for i = 1 to 4    for j = 1 to 4        cells(i, j + 5) = a(i, j)    next jnext ifor i = 1 to 3    for j = 1 to 3        cells(i + 5, j + 5) = b(i, j)    next jnext iend sub

Популярно: Информатика