A
A
Andrey Karasev2016-01-26 19:56:31
IT education
Andrey Karasev, 2016-01-26 19:56:31

Pascal task. Olympiad for schoolchildren. How to solve the problem?

The days of the week are numbered as follows: 1 - Monday, 2 - Tuesday, ..., 6 - Saturday, 7 - Sunday. Given an integer K in the range 1–365 and an integer N in the range 1–7.
Write a program that determines the number of the day of the week for the K-th day of the year, if it is known that this year January 1 was the day of the week with the number N.
Input data format
Two numbers are entered from the keyboard separated by a space — K (0 < K < 366) and
N (0 < N < 8).
Output data format
Display a single number - the number of the day of the week for the K-th day of the year.
Examples of input and output data:
Input
5 4
Output
1

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily, 2016-01-26
@Foolleren

a bit of functionality in the Pascal camp;
write(inc(y(x+x-2,7)))
we will leave the wrapper for later when the author confesses how he tried to solve it.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question