Вянваре михайловой начислена зарплата 21250 тысяч рублей. больничные 4800. из кассы предприятия на командировку получены 15000 рублей. расходы подтверждены на 15750 рублей(авансовый отчёт) 2 детей до 18 лет. рассчитать удержание зарплаты. составить проводки 68,69,70,71
149
316
Ответы на вопрос:
const
MAX=5;
var a:array[1..MAX,1..MAX] of integer;
n:integer;
ok:boolean;
i,j:integer;
sum:integer;
temp:integer;
begin
Write('Введите рамер матрицы (3..4)');
Readln(n);
Writeln('Введите строки матрицы!');
Writeln('После ввода ',n,' целых чисел нажимайте Enter!');
for i:=1 to n do
begin
Write('->');
for j:=1 to n-1 do
read(a[i,j]);
readln(a[i,n]);
end;
Ok:=True;
sum:=0;
for i:=1 to n do
sum:=sum+a[i,i];
{Вычисляем сумму по строкам}
i:=1;
repeat
temp:=0;
for j:=1 to n do
temp:=temp+a[i,j];
i:=i+1;
if temp <> sum then
ok:=False;
until (not ok) or (i>n);
if ok then
begin
j:=1;
repeat
temp:=0;
for i:=1 to n do
temp:=temp+a[i,j];
j:=j+1;
if temp <> sum then
ok:=False;
until (not ok) or (j>n);
if ok then
begin
temp:=0;
j:=n;
for i:=1 to n do
begin
temp:=temp+a[i,j];
j:=j-1;
end;
if temp<> sum then
ok:=False;
end;
end;
Write('Введенная матрица');
if not ok then
write('не');
Writeln('является магическим квадратом!');
readln;
end
MAX=5;
var a:array[1..MAX,1..MAX] of integer;
n:integer;
ok:boolean;
i,j:integer;
sum:integer;
temp:integer;
begin
Write('Введите рамер матрицы (3..4)');
Readln(n);
Writeln('Введите строки матрицы!');
Writeln('После ввода ',n,' целых чисел нажимайте Enter!');
for i:=1 to n do
begin
Write('->');
for j:=1 to n-1 do
read(a[i,j]);
readln(a[i,n]);
end;
Ok:=True;
sum:=0;
for i:=1 to n do
sum:=sum+a[i,i];
{Вычисляем сумму по строкам}
i:=1;
repeat
temp:=0;
for j:=1 to n do
temp:=temp+a[i,j];
i:=i+1;
if temp <> sum then
ok:=False;
until (not ok) or (i>n);
if ok then
begin
j:=1;
repeat
temp:=0;
for i:=1 to n do
temp:=temp+a[i,j];
j:=j+1;
if temp <> sum then
ok:=False;
until (not ok) or (j>n);
if ok then
begin
temp:=0;
j:=n;
for i:=1 to n do
begin
temp:=temp+a[i,j];
j:=j-1;
end;
if temp<> sum then
ok:=False;
end;
end;
Write('Введенная матрица');
if not ok then
write('не');
Writeln('является магическим квадратом!');
readln;
end
Популярно: Другие предметы
-
torshindanya13.05.2021 08:07
-
ооардпт06.02.2023 20:55
-
svetik040201p01o4x25.07.2020 20:24
-
wwdwd09.03.2022 13:52
-
ЛордТарнум13.02.2022 01:57
-
nikolasosadchey27.07.2022 11:05
-
killfa10.07.2021 17:57
-
Marksh21.02.2021 23:04
-
АбзикВ31.10.2022 09:47
-
SonyEricsson13.08.2021 14:19