Предмет: Информатика,
автор: lontrefef
Напишите программу,которая получает день,номер месяца и выводит кол-во дней,оставшихся до нового года)))Помогите пожалуйста!!!!!
Ответы
Автор ответа:
0
var
d,m,i,all:integer;
begin
read(d,m);
all:=0;
for i:=12 downto (m+1) do
begin
if i=12 then
all:=all+31;
if i=11 then
all:=all+30;
if i=10 then
all:=all+31;
if i=9 then
all:=all+30;
if i=8 then
all:=all+31;
if i=7 then
all:=all+31;
if i=6 then
all:=all+30;
if i=5 then
all:=all+31;
if i=4 then
all:=all+30;
if i=3 then
all:=all+31;
if i=2 then
all:=all+28;
if i=1 then
all:=all+31;
end;
if i=12 then
all:=all+31-d;
if i=11 then
all:=all+30-d;
if i=10 then
all:=all+31-d;
if i=9 then
all:=all+30-d;
if i=8 then
all:=all+31-d;
if i=7 then
all:=all+31-d;
if i=6 then
all:=all+30-d;
if i=5 then
all:=all+31-d;
if i=4 then
all:=all+30-d;
if i=3 then
all:=all+31-d;
if i=2 then
all:=all+28-d;
if i=1 then
all:=all+31-d;
writeln(all);
end.
d,m,i,all:integer;
begin
read(d,m);
all:=0;
for i:=12 downto (m+1) do
begin
if i=12 then
all:=all+31;
if i=11 then
all:=all+30;
if i=10 then
all:=all+31;
if i=9 then
all:=all+30;
if i=8 then
all:=all+31;
if i=7 then
all:=all+31;
if i=6 then
all:=all+30;
if i=5 then
all:=all+31;
if i=4 then
all:=all+30;
if i=3 then
all:=all+31;
if i=2 then
all:=all+28;
if i=1 then
all:=all+31;
end;
if i=12 then
all:=all+31-d;
if i=11 then
all:=all+30-d;
if i=10 then
all:=all+31-d;
if i=9 then
all:=all+30-d;
if i=8 then
all:=all+31-d;
if i=7 then
all:=all+31-d;
if i=6 then
all:=all+30-d;
if i=5 then
all:=all+31-d;
if i=4 then
all:=all+30-d;
if i=3 then
all:=all+31-d;
if i=2 then
all:=all+28-d;
if i=1 then
all:=all+31-d;
writeln(all);
end.
Автор ответа:
0
Сколько тут ветвлений?
Автор ответа:
0
24 + - )
Похожие вопросы
Предмет: Биология,
автор: alisakrivula
Предмет: Математика,
автор: margaritagefele
Предмет: Биология,
автор: Аноним
Предмет: Математика,
автор: Oksana321
Предмет: Алгебра,
автор: Юлия1313