#include <iostream>
int main() {
const int SIZE = 10;
bool isSence = false;
int sum = 0;
int count = 0;
int arr[SIZE];
for (int i = 0; i < SIZE; i++)
{
arr[i] = rand() % 20 - 10; // "рандомно" заполняем массив от -10 до 10
std::cout << arr[i] << "\t"; // выводим массив в консоль
if (arr[i] >= 0)
isSence = true;
}
for (int i = 0; i < SIZE; i++)
{
if ((isSence) && (arr[i] > 0))
sum += arr[i]; //sum = sum + arr[i];
count++;
}
if (isSence)
std::cout << "\nсреднее арифметическое положительных чисел = " << double(sum) / count << std::endl; // явное приведение типов
else
std::cout << "\nВ массиве нету положительных чисел или нету нулей и/или отрицательных чисел" << std::endl;
return 0;
}
var a:string;
i, o: Integer;
p: Real;
begin
readln(o);
a := inttostr(o);
for i := 1 to length(a) do
p := p + strtoint(a[i]);
if (sqr(o) = p*p*p) then writeln('true')
else writeln('false');
end.
2)
var a:string;
i, o, p: Integer;
begin
readln(o);
a := inttostr(o);
for i := 1 to length(a) do
p := p + strtoint(a[i]);
if (p mod 3 = 0) then writeln('true')
else writeln('false');
end.
3)
var a, b, c: real;
begin
readln(a, b, c);
if ((a = b) and (b = c)) then writeln('true')
else writeln('false');
end.
Всё проверено, удачи:)