• Срочно PascalABC!!!!!!!!! Дан одномерный массив A. Отсортировать по убыванию, найти среднее арифметическое положительных элементов

Ответы 2

  • Спасибо)))
    • Автор:

      julius
    • 6 лет назад
    • 0
  • Program fantscrin;

     const n = 10;  

     Var a: array [1..n] of integer;

         i,j,k:integer; s:real;

    Begin

     for i:=1 to n do

       a[i]:=random(20)-10;

     for i:=1 to n do

       write(a[i], '  ');

     

     for i:=1 to n do

       for j:=1 to n-1 do

         if (a[j]<a[j+1]) then

                          begin

                           k:=a[j];

                           a[j]:=a[j+1];

                           a[j+1]:=k;

                          end;

     

     writeln('');

     for i:=1 to n do

       write(a[i], '  ');

     for i:=1 to n do

       if (a[i] > 0) then s:=s+a[i];

     s:=s/n;

     writeln('');

     writeln(s);

    End.

  • Добавить свой ответ

Войти через Google

или

Забыли пароль?

У меня нет аккаунта, я хочу Зарегистрироваться

How much to ban the user?
1 hour 1 day 100 years