program z1;
var a: array [1..15] of real;
i, k, b: integer;
proizv: real;
begin
proizv:= 1;
a[1]:= 0.01;
a[2]:= -3;
a[3]:= 0;
a[4]:= 1.25;
a[5]:= -371;
a[6]:= 0.5;
a[7]:= -0.1;
a[8]:= 1.2;
a[9]:= -5;
a[10]:= -172.3;
a[11]:= 19783;
a[12]:= -2.7;
a[13]:= 43.51;
a[14]:= 0;
a[15]:= -0.02;
b:= -3;
k:= 0;
for i:=1 to 15 do
begin
if (a[i] <> 0) and (a[i] > b) then
begin
proizv:= proizv * a[i];
k:= k+1;
end;
end;
writeln('Количество чисел, подходящих условию: ', k);
writeln('Произведение чисел, подходящих условию: ', proizv);
end.
Объяснение:
На фото нарисована блок-схема, она немного криво сфоткана, надеюсь разберёшься. Если есть вопросы - задавай :)
#include <iostream>
using namespace std;
int main() {
// Variables
int number;
bool isPositive = false;
int numberCountDigits = 0;
// Input data
cout << "Input nubmer" << endl;
cin >> number;
// Create Solution
if (number > 999 || number < -999) {
cout << "Incorrect number" << endl;
return 0;
}
if (number >= 0) {
isPositive = true;
}
while (number != 0) {
numberCountDigits++;
number /= 10;
}
// Output Solution
cout << "-- Information --" << endl;
isPositive ? cout << "Is Positive number" << endl : cout << "Is Negative number" << endl;
cout << "Digits count: " << numberCountDigits << endl;
return 0;
}
var arr:массив(от 0 до 9),temp,n:ineger;
begin
//здесь заполнения массива случайными числами
temp=0;
пока i<9
n=n+arr[i];
i=i+1;
конец;
n=n/10; //n=среднее арифметическое чисел
пока j<9
if(abs(arr[j]-n)<temp) //abs=модуль
temp=arr[j];
j=j+1;
конец;
writeln(temp); //выводим самое близкое значение
writeln(n); //выводим среднее
end.