diff --git a/patterns/number_half_pyramid.cpp b/patterns/number_half_pyramid.c similarity index 100% rename from patterns/number_half_pyramid.cpp rename to patterns/number_half_pyramid.c diff --git a/patterns/pyramid_pattern.c b/patterns/pyramid_pattern.c new file mode 100644 index 0000000..57b6c16 --- /dev/null +++ b/patterns/pyramid_pattern.c @@ -0,0 +1,26 @@ +/* +Enter the number of rows: 6 + * + * * * + * * * * * + * * * * * * * + * * * * * * * * * +* * * * * * * * * * * +*/ +#include +void main() { + int i, a, rows, k = 0; + printf("Enter the number of rows: "); + scanf("%d", &rows); + for (i = 1; i <= rows; i++, k = 0) { + for (a= 1; a <=rows-i; a++) { + printf(" "); + } + while (k != 2 * i - 1) { + printf("* "); + k++; + } + printf("\n"); + } + +} diff --git a/patterns/reverse_half_pyramid b/patterns/reverse_half_pyramid.c similarity index 100% rename from patterns/reverse_half_pyramid rename to patterns/reverse_half_pyramid.c