Answer the question
In order to leave comments, you need to log in
How to fix the error in getting the number of days?
The essence of the program is to count the number of days in the summer months.
There is the following code:
% Copyright
implement main
open core, console, math, string
class facts
месяц : (string Имя_Месяца, unsigned Номер_по_порядку, unsigned Количество_дней).
class predicates
sumli : (unsigned C,unsigned Sum [out]) .
clauses
месяц("Январь", 1, 31).
месяц("Февраль", 2, 28).
месяц("Март", 3, 31).
месяц("Апрель", 4, 30).
месяц("Май", 5, 31).
месяц("Июнь", 6, 30).
месяц("Июль", 7, 31).
месяц("Август", 8, 31).
месяц("Сентябрь", 9, 30).
месяц("Октябрь", 10, 31).
месяц("Ноябрь", 11, 30).
месяц("Декабрь", 12, 31).
sumli(N,0):- N>8,!.
sumli(N,C):- месяц(_, N, Count),sumli(N+1,Count1),C=Count1+Count.
run() :-
setConsoleTitle("задача 8"),
sumli(6,Sum),
/* Sum = 0,
месяц(_, N, Count),
N >= 6,
N <= 8,
fail()
or
write("ответ: ", Sum),*/
write(Sum),
nl,
write("для закрытия нажмите любую клавишу"),
clearInput(),
_ = readChar().
% place your own code here
end implement main
goal
console::run(main::run).
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question