include stdio include stdlib define 50 int main void int ib max printf

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include <stdio.h>
#include <stdlib.h>
#define N 50
int main(void)
{
int l, i, ib=0, max=0, k=1;
printf ("Ââåäèòå ìàññèâ:\n");
for (i=0; i<N; i++)
scanf ("%lf", &M[i]);
for (i=1; i<N; i++)
{
if (M[i]==M[i-1])
k++ ;
else
{
if (k>max)
{
max=k;
ib=i-max;
k=1;
}
else
k=1;
}
}
if (k>max)
{
max=k;
ib=i-max;
k=1;
}
printf ("ib=%d, l=%d\n", ib, l );
printf ("\n");
l=ib+max;
printf ("Ïîëó÷åííàÿ ïîñëåäîâàòåëüíîñòü:\n");
for (i=ib; i<l ; i++)
printf ("%lf\n", M[i]);
printf ("\n");
printf ("ib=%d, l=%d\n", ib, l );
system("PAUSE");
return 0;
}