Алгоритми.
1.Скласти словарний алгоритм миття тарілок
2. Скласти словарний алгоритм обрахування площі трикутника.
3. Побудувати блок-схему алгоритму миття тарілок.
4. Побудувати блок-схему алгоритму обрахування площі прямокутника.
5. Скласти блок-схеми для розв’язання наступних задач:
А) Перевести введену користувачем сумму в гривнях в долари та євро.
Б) Обрахунку суми чисел від 0 до 12
Ответы
1 Here is a dictionary algorithm for washing dishes:
algorithm = {
"start": ["gather supplies", "rinse dishes", "scrape off excess food"],
"gather supplies": ["detergent", "sponge", "towel"],
"rinse dishes": ["place dishes in sink", "turn on water", "rinse dishes"],
"scrape off excess food": ["use scraper or brush to remove excess food from dishes"],
"detergent": ["squirt detergent onto sponge", "wash dishes with sponge"],
"place dishes in sink": ["place dishes in sink with hot water"],
"turn on water": ["turn on hot water to rinse dishes"],
"rinse dishes": ["rinse dishes under hot water"],
"use scraper or brush to remove excess food from dishes": ["use a scraper or brush to remove excess food from dishes"],
"squirt detergent onto sponge": ["squirt a small amount of dishwashing detergent onto the sponge"],
"wash dishes with sponge": ["scrub the dishes with the sponge, making sure to get all surfaces"],
"end": ["dry dishes", "put away dishes"]
}
2
Here is a dictionary algorithm for calculating the area of a triangle:
algorithm = {
"start": ["input base and height"],
"input base and height": ["base", "height"],
"base": ["enter the length of the base of the triangle"],
"height": ["enter the height of the triangle"],
"calculate area": ["multiply base by height and divide by 2"],
"output area": ["print the area of the triangle"],
"end": []
}
3
Here is a block diagram of the plate washing algorithm:
[Start]
|
|
[Gather supplies]
|
|
[Rinse dishes]
|
|
[Scrape off excess food]
|
|
[Detergent]
|
|
[End]
4
Here is a block diagram of the algorithm for calculating the area of a rectangle:
[Start]
|
|
[Input length and width]
|
|
[Calculate area]
|
|
[Output area]
|
|
[End]
5
A) Convert the amount entered by the user in hryvnias into dollars and euros.
[Start]
|
|
[Input amount in hryvnias]
|
|
[Convert to dollars]
|
|
[Convert to euros]
|
|
[Output converted amounts]
|
|
[End]
Б) Calculation of the sum of numbers from 0 to 12
[Start]
|
|
[Initialize sum to 0]
|
|
[Loop through numbers from 0 to 12]
|
|
[Add number to sum]
|
|
[Output sum]
|
|
[End]