PascalABC.NET
begin
var n := ReadInteger('n =');
var a := ArrRandom(n, -99, 99);
a.Println;
Println('Результат:', (a.Max + a.Min) / 2)
end.
Turbo Pascal
program abcd;
uses Crt;
const
nn = 100;
var
i, n, max, min: integer;
a: array[1..nn] of integer;
ClrScr;
Write('n = ');
Readln(n);
Randomize;
max := -32768;
min := 32767;
for i := 1 to n do
a[i] := Random(199) - 99;
Write(a[i], ' ');
if a[i] > max then
max := a[i]
else if a[i] < min then
min := a[i]
end;
Writeln;
Writeln('Результат: ', (max + min) / 2);
ReadKey
1)
print("Введите числа через пробел")
list1 = input().split()
counter = 0
for elem in list1:
if(elem[-1]=='2'):
counter += 1
print(counter)
2)
if(elem[-1]=='4'):
3)
if(elem[-1]=='7'):
4)
list2 = []
key = False
for i in list1:
if(len(i) >= 2):
key = True
list2.append(i)
list1 = [int(i) for i in list1]
if not(key):
print(min(list1[0:4]))
else:
print(min(list2))
То же самое в pastebin:
https://pastebin.com/byZKnUaF
PascalABC.NET
begin
var n := ReadInteger('n =');
var a := ArrRandom(n, -99, 99);
a.Println;
Println('Результат:', (a.Max + a.Min) / 2)
end.
Turbo Pascal
program abcd;
uses Crt;
const
nn = 100;
var
i, n, max, min: integer;
a: array[1..nn] of integer;
begin
ClrScr;
Write('n = ');
Readln(n);
Randomize;
max := -32768;
min := 32767;
for i := 1 to n do
begin
a[i] := Random(199) - 99;
Write(a[i], ' ');
if a[i] > max then
max := a[i]
else if a[i] < min then
min := a[i]
end;
Writeln;
Writeln('Результат: ', (max + min) / 2);
ReadKey
end.
1)
print("Введите числа через пробел")
list1 = input().split()
counter = 0
for elem in list1:
if(elem[-1]=='2'):
counter += 1
print(counter)
2)
print("Введите числа через пробел")
list1 = input().split()
counter = 0
for elem in list1:
if(elem[-1]=='4'):
counter += 1
print(counter)
3)
print("Введите числа через пробел")
list1 = input().split()
counter = 0
for elem in list1:
if(elem[-1]=='7'):
counter += 1
print(counter)
4)
list1 = input().split()
counter = 0
list2 = []
key = False
for i in list1:
if(len(i) >= 2):
key = True
list2.append(i)
list1 = [int(i) for i in list1]
if not(key):
print(min(list1[0:4]))
else:
print(min(list2))
То же самое в pastebin:
https://pastebin.com/byZKnUaF