Вопрос задан 04.05.2019 в 06:57. Предмет Информатика. Спрашивает Коробьев Влад.

Написать программу решающую задачу: 1. Напечатать таблицу перевода расстояний в дюймах в

сантиметрах (1 дюйм=2,54 см) для значений от 1 до 10 дюймов с шагом 1.
0 0
Перейти к ответам

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

Внимание! Ответы на вопросы дают живые люди. Они могут содержать ошибочную информацию, заблуждения, а также ответы могут быть сгенерированы нейросетями. Будьте внимательны. Если вы уверены, что ответ неверный, нажмите кнопку "Пожаловаться" под ответом.
Отвечает Данченко Роман.
Program p1;
var d:integer;
    s:string;
begin
for d:=1 to 10 do
begin
  if d>1 then s:='а';
  if d>4 then s:='ов';
  writeln(d,' дюйм',s,' = ',(d*2.54),' сантиметров');
end;
end.
0 0
Отвечает нейросеть ChatGpt. Будьте внимательны, ответы нейросети могут содержать ошибочные или выдуманные данные.

Program to Convert Inches to Centimeters

To solve the given task, we can write a simple program in Python to print a table for the conversion of distances from inches to centimeters. We'll use a loop to iterate through the values from 1 to 10 inches with a step of 1, and then convert each value to centimeters using the conversion factor of 1 inch = 2.54 centimeters.

Here's the Python program:

```python # Program to convert inches to centimeters and print a table print("Inches to Centimeters Conversion Table") print("Inches | Centimeters") print("--------------------") for i in range(1, 11): centimeters = i * 2.54 print(f"{i} | {centimeters:.2f}") ```

When you run this program, it will produce the following output:

Inches to Centimeters Conversion Table Inches | Centimeters -------------------- 1 | 2.54 2 | 5.08 3 | 7.62 4 | 10.16 5 | 12.70 6 | 15.24 7 | 17.78 8 | 20.32 9 | 22.86 10 | 25.40

This program uses a simple loop to iterate through the values from 1 to 10 inches and calculates the corresponding distance in centimeters using the conversion factor of 1 inch = 2.54 centimeters.

Feel free to try running this program in your Python environment to see the conversion table in action!

0 0

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

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

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