Consider the linear array T [1..n] whose elements are numbers equal to 0 or 1. Need a program that will determine the k-number of sequences of the array, formed by units only.
Example:
Entry: n = 10
array: 0 (1 1) 0 (1 1 1 1) 0 (1) {i've marked the digits in brackets so that you can have a better view on what's the actual idea}
Exit: k = 3
P.S.: Sorry for my bad English
Hope i get this solved soon, i need this ASAP for an exam T_T
also i have tried to figure out the program, here's my last update:
const n = 15;
var i,k:integer; x: array [1..n] of integer;
begin
Randomize;
k:=0;
for i:=1 to n do
begin
x
:=Random(2);
write(x,' ');
if x = x[i+1] then
k:=k+1;
end;
writeln(' k=',k);
end.
{The program calculates just how many digits of 0 are there(if u change '=' to '<>' it calculates how many units are there)}