#include "stdafx.h"
#include < iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout < < "obrabotka massiva" < < endl;
int array1[16] = { 5, -12, -12, 9, 10, 0, -9,
-12, -1, 23, 65, 64, 11, 43, 39, -15 }; // объявление и инициализация одномерного массива
cout < < "indeks" < < "\t\t" < < "element massiva" < < endl; // печать заголовков
for (int counter = 0; counter < 16; counter++) //начало цикла
{
//вывод на экран индекса ячейки массива, а затем содержимого этой ячейки, в нашем случае - это целое число
cout < < "array1[" < < counter < < "]" < < "\t\t" < < array1[counter] < < endl;
}
system("pause");
return 0;
}
program test;
type realarray = array of real;
var
step:real;
a:realarray;
i,n,s1,s2,s3,s4:integer;
begin
write('Введите количество членов последовательности: ');
readln(n);
step:=1/n;
setlength(a,n);
a[0]:=0;
for i:=1 to n-1 do a[i]:=a[i-1]+step;
for i:=0 to n-1 do begin
if a[i]<0.25 then s1:=s1+1;
if (a[i]>=0.25) and (a[i]<0.5) then s2:=s2+1;
if (a[i]>=0.5) and (a[i]<0.75) then s3:=s3+1;
if a[i]>=0.75 then s4:=s4+1;
end;
writeln('На промежутке [0,0.25) - ',s1);
writeln('На промежутке [0.25,0.5) - ',s2);
writeln('На промежутке [0.5,0.75) - ',s3);
writeln('На промежутке [0.75,1) - ',s4);
end.