We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9456c53 commit c61112dCopy full SHA for c61112d
0x04-more_functions_nested_loops/8-print_square.c
@@ -0,0 +1,30 @@
1
+#include "main.h"
2
+
3
+/**
4
+ * print_square - draws a square.
5
+ *
6
+ * @size: size of the square.
7
8
+ * Return: Nothing.
9
+ */
10
+void print_square(int size)
11
+{
12
+ int height;
13
+ int width;
14
15
+ if (size > 0)
16
+ {
17
+ for (height = 0; height < size; height++)
18
19
+ for (width = 0; width < size; width++)
20
21
+ _putchar('#');
22
+ }
23
+ if (height != size - 1)
24
25
+ _putchar('\n');
26
27
28
29
30
+}
0x04-more_functions_nested_loops/main.h
@@ -7,3 +7,4 @@ void print_most_numbers(void);
void more_numbers(void);
void print_line(int);
void print_diagonal(int);
+void print_square(int);
0 commit comments