Program go; var x,y,z,n:real; begin write('Введите сегодняшнее число: '); readln(x); write('Введите номер сегодняшнего месяца: '); readln(y); begin if y=1 then n:=365-x else; if y=2 then n:=365-31-x else; if y=3 then n:=365-31-28-x else; if y=4 then n:=365-31-28-31-x else; if y=5 then n:=365-31-28-31-30-x else; if y=6 then n:=365-31-28-31-30-31-x else; if y=7 then n:=365-31-28-31-30-31-30-x else; if y=8 then n:=365-31-28-31-30-31-30-31-x else; if y=9 then n:=365-31-28-31-30-31-30-31-31-x else; if y=10 then n:=365-31-28-31-30-31-30-31-31-30-x else; if y=11 then n:=365-31-28-31-30-31-30-31-31-30-31-x else; if y=12 then n:=365-31-28-31-30-31-30-31-31-30-31-30-x else; end; writeln ('До Нового года осталось: ',n); end.
Const m=5; //число строк n=10; //число столбцов var i,j:integer; s,k:array[1..n]of integer; //s для суммы, k для количества простых чисел a:array[1..m,1..n]of integer;
function prost(x:integer):boolean; //функция определения простого числа var i:integer; begin result:=true; for i:=2 to (x div 2) do if (x mod i=0) and (i<>x) then result:=false; end;
begin //заполнение случайными числами и вывод массива for i:=1 to m do begin for j:=1 to n do begin a[i,j]:=random(20)+1; write(a[i,j]:5); end; writeln; end; //Просмотр по столбцам и подсчет s и k for j:=1 to n do begin for i:=1 to m do if prost(a[i,j]) then begin s[j]:=s[j]+a[i,j]; k[j]:=k[j]+1; end; end; writeln('Количество простых чисел по столбцам:' ); for i:=1 to n do write(k[i]:5); writeln; writeln('Сумма простых чисел по столбцам:' ); for i:=1 to n do write(s[i]:5); end.
var x,y,z,n:real;
begin
write('Введите сегодняшнее число: ');
readln(x);
write('Введите номер сегодняшнего месяца: ');
readln(y);
begin
if y=1
then n:=365-x
else;
if y=2
then n:=365-31-x
else;
if y=3
then n:=365-31-28-x
else;
if y=4
then n:=365-31-28-31-x
else;
if y=5
then n:=365-31-28-31-30-x
else;
if y=6
then n:=365-31-28-31-30-31-x
else;
if y=7
then n:=365-31-28-31-30-31-30-x
else;
if y=8
then n:=365-31-28-31-30-31-30-31-x
else;
if y=9
then n:=365-31-28-31-30-31-30-31-31-x
else;
if y=10
then n:=365-31-28-31-30-31-30-31-31-30-x
else;
if y=11
then n:=365-31-28-31-30-31-30-31-31-30-31-x
else;
if y=12
then n:=365-31-28-31-30-31-30-31-31-30-31-30-x
else;
end;
writeln ('До Нового года осталось: ',n);
end.