Skip to content

solution to 04_31.c #8

@LuisCarlosOliveira

Description

@LuisCarlosOliveira

Regarding your solution to 04_31.

Editing your code, like below, shows the same result:

#include <stdio.h>

int main () {

int a, b, x, y, step1, step2, counter1 = 4, counter2 = 1;
for (step1 = 0; step1 < 5; step1++) {
for (x = counter1; x > 0; x--) {
    printf(" ");
}
for (y = 1 + (2 * step1); y > 0; y--) {
    printf("*");
}

printf("\n");
counter1--;
}

for (step2 = 3; step2 > -1; step2--) {
for (a = counter2; a > 0; a--) {
    printf(" ");
}
for (b = 1 + (2 * step2); b > 0; b--) {
    printf("*");
}


printf("\n");
counter2++;
}

return 0;

}


Best Regards.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions