Var c:array [1..10] of integer; i, even, positive, sumLessSix: integer; begin randomize; writeln ('Рандомный массив'); for i:=1 to 10 do begin c[i]:= random(20)-10; write (c[i],' '); end; {for} writeln; writeln('Произведение четных чисел'); even:=1; for i:=1 to 10 do if c[i] mod 2 = 0 then even:= even*c[i]; write(even,' '); writeln; writeln('Произведение положительных чисел'); positive:=1; for i:=1 to 10 do if c[i] > 0 then positive:= positive*c[i]; write(positive,' '); writeln; writeln('Сумма элементов меньших 6'); positive:=1; for i:=1 to 10 do if c[i] < 6 then sumLessSix:= sumLessSix+c[i]; write(sumLessSix,' '); end.
<HTML>
<HEAD>
<SCRIPT>
function btnClick()
{
s1=""; s2="";
var mas=["кот",123,"рыба",4.56,"лев",-71,"варан",9,"сова",123.456];
for (i=0; i<mas.length; i++) {
s1 = s1+mas[i]+" ";
if (mas[i]*1 == mas[i]) s2 = s2+mas[i]+" ";
};
document.frm.res1.value=s1;
document.frm.res2.value=s2;
}
</SCRIPT>
</HEAD>
<BODY>
<FORM name=frm>
<INPUT type="button" value="Щелкни здесь!"
onClick="btnClick();">
<P>
<H1>Массив:</H1>
<TEXTAREA name="res1" cols="50" rows="5">
</TEXTAREA>
<P>
<H1>Результат:</H1>
<TEXTAREA name="res2" cols="50" rows="5">
</TEXTAREA>
</FORM>
</BODY>
</HTML>