// PascalABC.NET 3.1, сборка 1218 от 12.04.2016 begin var a:=ArrRandom(ReadInteger('n='),-50,50); a.Println; Writeln('s=',a.Select((x,i)->Rec(x,i+1)).Where(x->x.Item1>0) .Select(x->x.Item2).Sum) end.
Var a:array [1..1000] of integer; i,n,s:integer; begin s:=0; writeln ('Введите размер массива'); readln (n); for i:= 1 to n do begin write ('a[',i,']= '); readln (a[i]); if a[i]>0 then s:=s+i; end; writeln ('Сумма индексов положительных элементов = ',s); end.
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку