
Решение задач с использованием операторов цикла. Начав тренировки, лыжник в первый день пробежал
10 км. Каждый следующий день он увеличивал пробeг на 10% от пробега предыдущего дня. Определить на какой день он пробежит больше 20 км;

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

Ответ:var s:real; k:integer; // описание переменных
begin
s:=10; // пробег в 1-й день
k:=1;
while s<20 do // пока пробег < 20 км
begin
k:=k+1; // добавляем один день
s:=s*1.1; // увеличиваем пробег на 10%
end;
writeln('s = ',s,' k = ',k); // выводим на экран результаты
end.
Результат:
s = 21.4358881 k = 9



#include <iostream>
using namespace std;
int main(){
int cnt = 2;
double k = 10;
while(k <= 20){
k *= 1.1;
cnt++;
}
cout << cnt;
}



Problem Analysis
To solve this problem, we need to determine on which day the skier will run more than 20 km. The skier starts by running 10 km on the first day and then increases the distance by 10% each subsequent day. We can use a loop to simulate the skier's daily progress until the distance exceeds 20 km.Solution
Here's a step-by-step solution to the problem:1. Initialize the distance variable to 10 km, representing the skier's distance on the first day. 2. Initialize the day variable to 1, representing the first day. 3. Enter a loop that continues until the distance exceeds 20 km. 4. Inside the loop, calculate the distance for the next day by multiplying the previous day's distance by 1.1 (to increase it by 10%). 5. Increment the day variable by 1. 6. Repeat steps 4-5 until the distance exceeds 20 km. 7. Print the value of the day variable, which represents the day on which the skier will run more than 20 km.
Let's implement this solution in Python:
```python distance = 10 day = 1
while distance <= 20: distance *= 1.1 day += 1
print("The skier will run more than 20 km on day", day) ```
Running this code will output the day on which the skier will run more than 20 km.
Example Output
For the given problem, the skier will run more than 20 km on day 9.Conclusion
In this problem, we used a loop to simulate the skier's daily progress and determine the day on which they will run more than 20 km. By incrementing the distance by 10% each day, we were able to find the solution.

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







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