Напишите программу которая считает произведение цифр введенного натурального числа..
103
315
Ответы на вопрос:
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
Популярно: Информатика
-
AnNik0802.12.2022 01:24
-
Pandochkalove703.11.2022 10:34
-
xenia0000005.03.2020 09:17
-
Какосик1006.04.2020 17:41
-
djekichan12327.08.2020 05:53
-
кульпан115.09.2021 11:19
-
Екатерина2087612.02.2021 07:46
-
alina20012027.04.2022 18:47
-
пожирательзнаний103.06.2023 08:11
-
draaams23.09.2021 07:03