Begin
var a:=ArrRandom(30, -100, 100);
var k:=a.Where(t->t<0);
a.Print;
println();
println('Cумма: ', k.Sum);
end.
Const
n = 5;
var
arr: array [1..n] of integer;
i, N1, sum: integer;
begin
write('N = ');
readln(N1);
for i := 1 to n do
begin
write('A[', i, '] = ');
readln(arr[i]);
end;
i := 1;
sum := 0;
while (sum <= N1) and (i <= n) do
begin
sum := sum + arr[i];
i := i + 1;
end;
if sum > N1 then
writeln(sum)
else
writeln('Summa not grether then N');
end.
' Basic
' For ... Next
dim yi as integer
dim n as integer
dim z as double
dim sum as double
dim zi as double
sum = 0
print "Введите n: "
input n
for yi = 1 to n
if ((yi > 15) or (yi < 0)) then
z = 2
else
z = yi
end if
zi = (sqr(z)-z)*(sqr(z)-z)
sum = sum + zi
next
print "Сумма = ", sum;
'-----------------------------------------------------------
' While Wend
dim yi as integer
dim n as integer
dim z as double
dim sum as double
dim zi as double
sum = 0
yi = -1
print "Введите n: "
input n
while (yi < n)
if ((yi > 15) or (yi < 0)) then
z = 2
else
z = yi
end if
zi = (sqr(z)-z)*(sqr(z)-z)
sum = sum + zi
yi = yi + 1
wend
print "Сумма =", sum;
Можно разместить посты в соц.сетях таких как:
Так же на различных форумах на разные темы!!!