
Написать программу Pascal для печати звездочками одной из фигур: в)домика


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

скачать просто в ине и всё



Program in Pascal to Print a House Shape
Here's a program written in Pascal that prints a house shape using asterisks:
```pascal program PrintHouse;
var i, j, n: integer;
begin n := 5; // number of rows for the house shape
// print the roof for i := 1 to n do begin for j := 1 to n - i do write(' '); for j := 1 to 2 * i - 1 do write('*'); writeln; end;
// print the walls for i := 1 to n do begin write('*'); for j := 1 to 2 * n - 3 do begin if i = n then write('*') else write(' '); end; writeln('*'); end;
// print the base for i := 1 to 2 * n - 1 do write('*'); writeln; end. ```
This program uses nested loops to print the roof, walls, and base of the house shape. The variable `n` determines the number of rows for the house shape, and you can adjust it to change the size of the house.
The program starts by printing the roof using two nested loops. The outer loop controls the number of rows, and the inner loops print the spaces and asterisks for each row.
Next, the program prints the walls using another set of nested loops. The outer loop controls the number of rows, and the inner loop prints the spaces and asterisks for each row. The condition `if i = n then` is used to determine whether to print asterisks or spaces for the last row of the walls.
Finally, the program prints the base by printing a row of asterisks.
To run this program, you can use a Pascal compiler or an online Pascal compiler.
I hope this helps! Let me know if you have any further questions.


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