
Составить программу, определяющую животное, соответствующее году по китайскому гороскопу


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

Program god_Japan;
var y, y1: Integer;
color : Integer;
beast : Integer;
begin
Write('Введите год');
ReadLn(year);
year1 := ((year - 1984) mod 60 + 60) mod 60;
beast := year1 mod 12;
color := (year1 div 12) mod 5;
Write(year, ' - год ');
if beast in [2, 3, 4] then
case color of
0: Write('зеленого');
1: Write('красного');
2: Write('желтого');
3: Write('белого');
4: Write('черного');
end
else
case color of
0: Write('зеленой');
1: Write('красной');
2: Write('желтой');
3: Write('белой');
4: Write('черной');
end;
Write(' ');
case beast of
0: Write('Крысы');
1: Write('Коровы');
2: Write('Тигра');
3: Write('Зайца');
4: Write('Дракона');
5: Write('Змеи');
6: Write('Лошади');
7: Write('Овцы');
8: Write('Обезьяны');
9: Write('Курицы');
10: Write('Собаки');
11: Write('Свиньи');
end;
WriteLn();
end.



var a, b, c, i:integer;
begin
read (a);
a:=a-4;
if a = -3 then write ('Петух');
if a = -2 then write ('Собака');
if a = -1 then write ('Свинья');
if a mod 12 = 0 then writeln ('Крыса');
if a mod 12 = 1 then writeln ('Бык');
if a mod 12 = 2 then writeln ('Тигр');
if a mod 12 = 3 then writeln ('Кролик');
if a mod 12 = 4 then writeln ('Дракон');
if a mod 12 = 5 then writeln ('Змея');
if a mod 12 = 6 then writeln ('Лошадь');
if a mod 12 = 7 then writeln ('Овца');
if a mod 12 = 8 then writeln ('Обезьяна');
if a mod 12 = 9 then writeln ('Петух');
if a mod 12 = 10 then writeln ('Собака');
if a mod 12 = 11 then writeln ('Свинья');
end.



Program to Determine the Chinese Zodiac Animal
To create a program that determines the animal corresponding to a given year in the Chinese zodiac, you can use the following steps:
1. Define the Chinese Zodiac Animals: - The Chinese zodiac consists of 12 animals: Rat, Ox, Tiger, Rabbit, Dragon, Snake, Horse, Goat, Monkey, Rooster, Dog, and Pig.
2. Calculate the Zodiac Animal for a Given Year: - The Chinese zodiac is based on a 12-year cycle, with each year being represented by a specific animal. - To determine the zodiac animal for a given year, you can use the remainder of the year when divided by 12 and map it to the corresponding animal.
3. Example Program in Python: - Here's an example of a simple Python program to determine the Chinese zodiac animal for a given year:
``` year = int(input("Enter the year: ")) animals = ['Monkey', 'Rooster', 'Dog', 'Pig', 'Rat', 'Ox', 'Tiger', 'Rabbit', 'Dragon', 'Snake', 'Horse', 'Goat'] zodiac_animal = animals[year % 12] print("The zodiac animal for the year", year, "is", zodiac_animal) ```
This program takes the input year, calculates the zodiac animal based on the remainder when divided by 12, and then prints the result.
4. Testing the Program: - You can test the program by entering different years and verifying if the output corresponds to the correct Chinese zodiac animal for that year.
Additional Information
The Chinese zodiac is deeply rooted in Chinese culture and is based on a 12-year cycle, with each year being represented by a specific animal. The zodiac signs are often used to determine personality traits, compatibility, and even to make predictions about the future. If you have any further questions about the Chinese zodiac or programming, feel free to ask!

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







Последние заданные вопросы в категории Информатика
-
Математика
-
Литература
-
Алгебра
-
Русский язык
-
Геометрия
-
Английский язык
-
Химия
-
Физика
-
Биология
-
Другие предметы
-
История
-
Обществознание
-
Окружающий мир
-
География
-
Українська мова
-
Информатика
-
Українська література
-
Қазақ тiлi
-
Экономика
-
Музыка
-
Право
-
Беларуская мова
-
Французский язык
-
Немецкий язык
-
МХК
-
ОБЖ
-
Психология
-
Физкультура и спорт
-
Астрономия
-
Кыргыз тили
-
Оʻzbek tili