Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Assignment 1
//fpc 3.0.0 program assignmentpt2; var month, year, dim, y_s, m_sc, ph, delay:integer; // y_s = year_start, m_sc = Month_Start & Count, dim = days in month, ph = placeholder month_n:string; // month_n = month_names begin y_s := 4; // to set the starting date in 1970 because 1970 starts on Thursday readln(year, month); // User input for year & month if month = 1 then begin month_n := 'January '; // When user types in 1~12 it replaces it to corresponding month delay := 0; end; if month = 2 then begin month_n := 'February '; delay := 3; end; if month = 3 then begin month_n := 'March '; delay := 3; end; if month = 4 then begin month_n := 'April '; delay := 6; end; if month = 5 then begin month_n := 'May '; delay := 1; end; if month = 6 then begin month_n := 'June '; delay := 4; end; if month = 7 then begin month_n := 'July '; delay := 6; end; if month = 8 then begin month_n := 'August '; delay := 2; end; if month = 9 then begin month_n := 'September '; delay := 5; end; if month = 10 then begin month_n := 'October '; delay := 0; end; if month = 11 then begin month_n := 'November '; delay := 3; end; if month > 12 then begin month_n := 'December '; delay := 5; end; writeln(month_n:(length(month_n)+4) div 2 + 10, year); writeln(' Sun Mon Tue Wed Thu Fri Sat'); if (month = 4) or (month = 6) or (month = 9) or (month = 11) then begin dim := 30; end else if month = 2 then begin if (year mod 4 = 0) and (year mod 100 <> 0) then begin dim := 29; end else begin dim := 28; end; if year mod 400 = 0 then begin dim := 29; end; end else begin dim := 31; end; y_s := (y_s + year - 1970 + (year - 1970) div 4 - (year - 1970) div 100 + (year - 1970) div 400) mod 7; m_sc := (y_s + delay) mod 7; if m_sc + dim > 35 then begin if m_sc + dim = 36 then begin if dim = 31 then begin write(' 31'); end else begin write(' 30'); end; ph := 2; dim := dim - 1; end; if m_sc + dim = 37 then begin write(' 30 31'); ph:= 3; dim := dim - 2; end; end else begin ph:= 1; end; for ph := ph to m_sc do begin write(' '); end; for ph := 1 to dim do begin write(ph:4); m_sc := m_sc +1; if m_sc = 7 then begin writeln(''); m_sc := 0; end; end; readln() end.
run
|
edit
|
history
|
help
0
test27
JOZIANE NEVES DE SOUZA 600630041
Подсчёт количества целочисленных точек внутри круга радиуса r
Урок 3, задача 5 Задача 1478. Урок в неделе
test25
practica 3 ejercicio B7
jhjj
1
111
Сортировка массиа прямым выбором