This commit is contained in:
Huaqo
2024-11-28 17:05:14 +01:00
parent b034aad83f
commit 19b5b201b0
205 changed files with 0 additions and 2340 deletions
+46
View File
@@ -0,0 +1,46 @@
#include <cs50.h>
#include <stdio.h>
int main(void)
{
int size;
int spaces;
int hashes;
// Asking for size
do
{
size = get_int("Size: ");
}
while (size < 1 || size > 8);
// Building
for (int i = 0; i < size; i++)
{
// left spaces
for (spaces = (size - i); spaces >= 2; spaces--)
{
printf(" ");
}
// hashes
for (hashes = 0; hashes <= i; hashes++)
{
printf("#");
}
// middle spaces
printf(" ");
// hashes
for (hashes = 0; hashes <= i; hashes++)
{
printf("#");
}
// next line
printf("\n");
}
}