uses
crt;
const
max=50;
var
a:array[1..max,1..max] of integer;
i,j,n,s,k:integer;
begin
writeln('wvedite razmernost matrici');
readln(n);
writeln('wvedite matricu ',n,' x ',n);
for i:= 1 to n do
begin
for j:= 1 to n do
read(a[i,j]);
end;
s:=0;
k:=0;
for i:= 1 to n do
begin
for j:= 1 to n do
if (j mod 2<>0) and (i mod 2<>0) then
begin
s:=a[i,j]+s;
k:=k+1
end;
end;
s:=round(s/k);
writeln('sredne arifmet znashenie s neshetnimi indeksami ravno ', s);
readkey
end.
import random
def GenEx(count):
signs = ['+', '-', '*', '/']
for _ in range(count):
fn = random.randint(-20, 20)
sn = random.randint(-20, 20)
ex = '{0} {1} {2}'.format(fn, random.choice(signs), sn)
yield (ex + ' = ?', eval(ex))
IsGameRun = True
while IsGameRun:
TrueAnsws = 0
for ex, check in GenEx(2):
print(ex)
resvAnsw = float(input())
if resvAnsw == check: TrueAnsws += 1;
IsRetry = input('You correctly solved '+str(TrueAnsws)+' examples. Do you want to try again? Y/N \n')
if IsRetry == 'Y': IsGameRun = True
else: IsGameRun = False
Объяснение: