Предмет: Информатика, автор: juliamelnichuck

Дан целочисленный массив А[1...100], элементы которого неотрицательны. Необходимо заполнить таблицу действительных чисел В[1...100], i-ый элемент которой равен среднему арифметическому первых i элементов массива А

Ответы

Автор ответа: Gilbord
0
const Num=100;

type MasInt=array[1..Num] of integer;
    MasReal=array[1..Num] of real;


var A:MasInt;
    B:MasReal;
    i:integer;
    
function Arifm(var A:MasInt; i:integer):real;
var j, sum, k:integer;
begin
sum:=0;
k:=0;
for j:=1 to i do
    begin
    sum:=sum+A[j];
    inc(k);
    end;
Arifm:=sum/k;
end;
    
begin
randomize;
for i:=1 to Num do
begin
A[i]:=random(100);
write(A[i], ' ');
end;
writeln();
for i:=1 to Num do
begin
B[i]:=Arifm(A, i);
write(B[i], ' ');
end;
end.
Похожие вопросы
Предмет: Английский язык, автор: wewaf43982
1) I didn’t expect ___________________________ (he/be) so rude.
Выберите один ответ:
a. him to be
b. he is
c. his be
d. he had been being

2) It was rare __________________ (предлог?) him to go out in the evenings.
Выберите один ответ:
a. to
b. of
c. on
d. for

3) In Russian we had to learn a lot of grammar rules by______.
Выберите один ответ:
a. mind
b. hard
c. heart
d. hand

4) Would you sooner I _____________________ (know) nothing?
Выберите один ответ:
a. have known
b. know
c. knew
d. had known

5) You __________________ follow her advice. It’ll do you good.
Выберите один ответ:
a. had rather
b. would rather
c. had better
d. would better

6) I want this letter __________________________ (send) at once.
Выберите один ответ:
a. to send
b. to be sent
c. to have sent
d. being sent

7) Would you _________________ have coffee or tea?
Выберите один ответ:
a. prefer
b. rather to
c. sooner
d. better

8) _________________ you meet Darren, give him my regards.
Выберите один или несколько ответов:
a. should
b. in case
c. unless
d. provided

9) She _________________________ (recommend) as a suitable candidate for the job.
Выберите один или несколько ответов:
a. will be recommending
b. has been recommended
c. recommends
d. was recommended

10) I wish I _______________________ (go) to Paris with you.
Выберите один или несколько ответов:
a. could go
b. had gone
c. will go
d. am going

11) Scholars often refer to these as_____ of “capital,” because each can be cashed in for access to prestigious jobs and high salaries.
Выберите один или несколько ответов:
a. advantages
b. benefits
c. points
d. pros