Вопрос задан 30.09.2018 в 02:00. Предмет Информатика. Спрашивает Декань Вова.

Дан год. Вывести на экран на экран название животного, символизирующего этот год по восточному

календарю (cock, dog, pig, rat, bull, tiger, rabbit, dragon, snake, horse, sheep, monkey).Формат входных данных:Входной файл содержит натуральное число Формат выходных данных:В выходной файл выведите ответ на поставленную задачу.
0 0
Перейти к ответам

Ответы на вопрос

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Филиппская Настя.
Var
x,y:integer;
a:array [1..12] of string;
begin
a[1]:=cock;
..
a[12]:=monkey;
read(x);
y:=(abs(2016-x) )mod 12;
write(a[y]);
end.

Вроде должно работать. Проверить не могу - сижу с телефона

0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

To solve this task, you need to determine the animal symbolizing the given year according to the Eastern calendar. Here's a Python code snippet that can help you achieve this:

```python def get_animal(year): animals = ['cock', 'dog', 'pig', 'rat', 'bull', 'tiger', 'rabbit', 'dragon', 'snake', 'horse', 'sheep', 'monkey'] index = (year - 1924) % 12 return animals[index]

year = int(input("Enter the year: ")) animal = get_animal(year) print(f"The animal symbolizing the year {year} is {animal}.") ```

This code defines a function `get_animal()` that takes the year as input and returns the corresponding animal symbol. The list `animals` contains the names of the animals in the Eastern calendar order. The index of the animal is calculated using the formula `(year - 1924) % 12`, where 1924 is the start year of the Eastern calendar cycle. Finally, the code prompts the user to enter a year, calls the `get_animal()` function, and prints the result.

Please note that this code assumes the input year is a positive integer. You can modify it to handle different input requirements if needed.

Let me know if you need any further assistance!

0 0

Топ вопросов за вчера в категории Информатика

Последние заданные вопросы в категории Информатика

Задать вопрос