Вопрос задан 16.02.2019 в 23:32. Предмет Информатика. Спрашивает Рахматуллина Эвелина.

В программе BASIC.Составить программу по теме "Цикл с условием" Изумруд диаметр 10 см помещен в

квадратную шкатулку. Размеры, которой подобрали точно по размеру изумруда, эта шкатулка помещена в другую шкатулку, которая вложена в следующую и т.. д. Длина стороны большой шкатулки равна 1метру, а толщина =1см, сколько шкатулок надо открыть, чтобы достать изумруд.
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Ефимов Виталя.
Шкатулка с изумрудом имеет размер стороны, равный диаметру изумруда, т.е. 10 см. При толщине стенок 1 см, внешний размер шкатулки будет равен 10+1+1=12 см и эти же 12 см - внутренний размер следующей шкатулки. А её внешний размер снова на 2 см больше внутреннего. И так далее.

n = 1
a = 10
DO WHILE a <> 100
   a = a + 2
   n = n + 1
LOOP
PRINT n

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

To solve this problem using the BASIC programming language, we can use a loop with a condition to determine the number of boxes that need to be opened to retrieve the emerald. Here's an example program:

```BASIC REM Set the initial values DIM diameter AS INTEGER DIM boxSize AS INTEGER DIM numBoxes AS INTEGER

diameter = 10 boxSize = 100 numBoxes = 0

REM Loop until the box size is smaller than the diameter of the emerald WHILE boxSize >= diameter boxSize = boxSize - 1 numBoxes = numBoxes + 1 WEND

PRINT "Number of boxes to open: "; numBoxes ```

Let's break down the program:

1. We declare three variables: `diameter` to store the diameter of the emerald (10 cm), `boxSize` to store the size of the current box (initially set to 100 cm), and `numBoxes` to keep track of the number of boxes opened.

2. We enter a `WHILE` loop that continues until the `boxSize` is smaller than the `diameter` of the emerald.

3. Inside the loop, we subtract 1 from the `boxSize` and increment the `numBoxes` by 1.

4. Once the loop condition is no longer true (i.e., the `boxSize` is smaller than the `diameter`), we exit the loop.

5. Finally, we print the value of `numBoxes`, which represents the number of boxes that need to be opened to retrieve the emerald.

To run this program, you can use a BASIC interpreter or an online BASIC compiler. Simply copy and paste the code into the interpreter/compiler and execute it. The program will output the number of boxes that need to be opened.

Please note that the program assumes that the size of each box decreases by 1 cm when placed inside a larger box.

0 0

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

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

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