const n=5;
var
a:array [1..n,1..n] of integer;
i,j,k:integer;
begin
k:=0;
for i:=1 to n do
for j:=1 to n do
a[i,j]:=random(151)-50;
write(a[i,j]:4);
if (a[i,j] mod 5 =0) then
inc(k);
end;
writeln;
if k<>0 then
if a[i,j]=k then a[i,j]:=0;
writeln('K= ',k);
end
else
a[i,j]:=0;
writeln('K= 0');
end.
import datetime
from calendar import monthrange
birth_day = int(input("Day of birth: "))
birth_month = int(input("Month of birth: "))
birth_year = int(input("Year of birth: "))
day = int(datetime.date.today().day)
month = int(datetime.date.today().month)
year = int(datetime.date.today().year)
if birth_month <= month:
if birth_day <= day:
a = year - birth_year
b = abs(month - birth_month)
c = abs(day - birth_day)
else:
a = (year - birth_year) - 1
b = 11 - abs(month - birth_month)
c = monthrange(year, month)[1] - abs(day - birth_day)
print("Your age: {} years, {} months, {} days".format(a,b,c))
Объяснение:
const n=5;
var
a:array [1..n,1..n] of integer;
i,j,k:integer;
begin
k:=0;
for i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=random(151)-50;
write(a[i,j]:4);
if (a[i,j] mod 5 =0) then
inc(k);
end;
writeln;
end;
writeln;
if k<>0 then
begin
for i:=1 to n do
begin
for j:=1 to n do
begin
if a[i,j]=k then a[i,j]:=0;
write(a[i,j]:4);
end;
writeln;
end;
writeln('K= ',k);
end
else
begin
for i:=1 to n do
begin
for j:=1 to n do
begin
a[i,j]:=0;
write(a[i,j]:4);
end;
writeln;
end;
writeln('K= 0');
end;
end.
import datetime
from calendar import monthrange
birth_day = int(input("Day of birth: "))
birth_month = int(input("Month of birth: "))
birth_year = int(input("Year of birth: "))
day = int(datetime.date.today().day)
month = int(datetime.date.today().month)
year = int(datetime.date.today().year)
if birth_month <= month:
if birth_day <= day:
a = year - birth_year
b = abs(month - birth_month)
c = abs(day - birth_day)
else:
a = (year - birth_year) - 1
b = 11 - abs(month - birth_month)
c = monthrange(year, month)[1] - abs(day - birth_day)
else:
a = (year - birth_year) - 1
b = 11 - abs(month - birth_month)
c = monthrange(year, month)[1] - abs(day - birth_day)
print("Your age: {} years, {} months, {} days".format(a,b,c))
Объяснение: