From d09b1a288ae51fe2e141676948d225296f2f7d72 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 2 Nov 2023 15:00:22 +0200 Subject: [w3] Added solutions --- week03/exercise02-bonus.cpp | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 week03/exercise02-bonus.cpp (limited to 'week03/exercise02-bonus.cpp') diff --git a/week03/exercise02-bonus.cpp b/week03/exercise02-bonus.cpp new file mode 100644 index 0000000..6b553ad --- /dev/null +++ b/week03/exercise02-bonus.cpp @@ -0,0 +1,15 @@ +#include + +int main() { + int x; + std::cin >> x; + double step = 10.0 / x; + double length = step; + while (length <= 10) { + for (int col = 0; col < length; col++) { + std::cout << '#'; + } + std::cout << std::endl; + length += step; + } +} -- cgit v1.2.3