From 9ce05da1d9c6f2ffbce740f12412405c340065ef Mon Sep 17 00:00:00 2001 From: Inex Code Date: Wed, 16 Sep 2020 09:27:26 +0000 Subject: [PATCH] Homework 1: task 2 --- Hw1/task2.cpp | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/Hw1/task2.cpp b/Hw1/task2.cpp index 1b489df..5a92212 100644 --- a/Hw1/task2.cpp +++ b/Hw1/task2.cpp @@ -16,12 +16,31 @@ void part1(uint N, uint M) cout << "\n"; } +void part2(uint N, uint M) +{ + for (uint n = 0; n < N; n++) + { + if (n < M) + for (uint i = 0; i < M-n; i++) + { + cout << " "; + } + for (uint j = 0; j < n*2; j++) + { + cout << "*"; + } + cout << "\n"; + } + cout << "\n"; +} + int main() { - uint N = 5; + uint N = 6; uint M = 6; part1(N, M); + part2(N, M); return 0; }