Skip to content

Commit

Permalink
feat: day 5
Browse files Browse the repository at this point in the history
  • Loading branch information
Faelayis committed Sep 26, 2023
1 parent c18a63d commit 81582ef
Show file tree
Hide file tree
Showing 8 changed files with 169 additions and 0 deletions.
14 changes: 14 additions & 0 deletions COM-1308/26-09-66/asterisk.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <stdio.h>

int main() {
int x;

for (x; x <= 5; x++) {
printf("*");
}

printf("\n");
return 0;

// output: ******
}
23 changes: 23 additions & 0 deletions COM-1308/26-09-66/asterisk_box.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>

int main() {
int x, i;

for (x; x <= 5; x++) {
for (i = 1; i <= 5; i++) {
printf("* ");
}
printf("\n");
}

printf("\n");
return 0;

/* output:
* * * * *
* * * * *
* * * * *
* * * * *
* * * * *
*/
}
23 changes: 23 additions & 0 deletions COM-1308/26-09-66/pyramid_12345.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>

int main() {
int x, i;

for (x = 1; x <= 5; x++) {
for (i = 1; i <= x; i++) {
printf("%d ", i);
}
printf("\n");
}

printf("\n");
return 0;

/* output:
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
*/
}
29 changes: 29 additions & 0 deletions COM-1308/26-09-66/pyramid_reverse.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#include <stdio.h>

int main() {
int rows = 5, x, o, i;

for (x = 1; x <= rows; x++) {
for (i = 1; i <= rows - x; i++) {
printf(" ");
}

for (o = 1; o <= x; o++) {
printf("* ");
}

printf("\n");
}

printf("\n");
return 0;

// clang-format off
/* output:
*
* *
* * *
* * * *
* * * * *
*/
}
2 changes: 2 additions & 0 deletions COM-1308/26-09-66/todo/classroom.url
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[InternetShortcut]
URL=https://classroom.google.com/c/NjE0MzkzNDIzNDI1/a/NTI5MjUyMDY5MTE5/details
23 changes: 23 additions & 0 deletions COM-1308/26-09-66/todo/left_side.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>

int main() {
int x, i;

for (x = 5; x >= 1; --x) {
for (i = 1; i <= x; ++i) {
printf("* ");
}
printf("\n");
}

printf("\n");
return 0;

/* output:
* * * * *
* * * *
* * *
* *
*
*/
}
27 changes: 27 additions & 0 deletions COM-1308/26-09-66/todo/right_angled.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>

int main() {
int x, i;

for (x = 1; x <= 5; ++x) {
for (i = 1; i < x; ++i) {
printf(" ");
}
for (i = x; i <= 5; ++i) {
printf("* ");
}
printf("\n");
}

printf("\n");
return 0;

// clang-format off
/* output:
* * * * *
* * * *
* * *
* *
*
*/
}
28 changes: 28 additions & 0 deletions COM-1308/26-09-66/todo/right_side.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stdio.h>

int main() {
int x, i;

for (x = 1; x <= 5; ++x) {
for (i = 1; i <= 5 - x; ++i) {
printf(" ");
}

for (i = 1; i <= x; ++i) {
printf("* ");
}
printf("\n");
}

printf("\n");
return 0;

// clang-format off
/* output:
*
* *
* * *
* * * *
* * * * *
*/
}

0 comments on commit 81582ef

Please sign in to comment.