From e732fd4c23eb136227e5140505e2156855a2ead3 Mon Sep 17 00:00:00 2001 From: Drishty Ganatra <77919644+Drishty06@users.noreply.github.com> Date: Tue, 25 May 2021 16:28:44 +0530 Subject: [PATCH 1/5] Add files via upload --- patterns/pattern05.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patterns/pattern05.c diff --git a/patterns/pattern05.c b/patterns/pattern05.c new file mode 100644 index 0000000..ec653ac --- /dev/null +++ b/patterns/pattern05.c @@ -0,0 +1,26 @@ +/*1 + 22 + 333 + 4444*/ +#include +void pattern(int x); +int main() +{ + int n; + printf("Enter the number of rows "); + scanf("%d",&n); + pattern(n); + return 0; +} +void pattern(int x) +{ + int i,j; + for(i=1;i<=x;i++) + { + for(j=1;j<=i;j++) + { + printf("%d",i); + } + printf("\n"); + } +} From 39a88fe694255e7f392979d9932418a80f37c1d0 Mon Sep 17 00:00:00 2001 From: Drishty Ganatra <77919644+Drishty06@users.noreply.github.com> Date: Tue, 25 May 2021 16:29:50 +0530 Subject: [PATCH 2/5] Update and rename pattern05.c to pyramid_with_numbers.c --- patterns/{pattern05.c => pyramid_with_numbers.c} | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) rename patterns/{pattern05.c => pyramid_with_numbers.c} (73%) diff --git a/patterns/pattern05.c b/patterns/pyramid_with_numbers.c similarity index 73% rename from patterns/pattern05.c rename to patterns/pyramid_with_numbers.c index ec653ac..8221aeb 100644 --- a/patterns/pattern05.c +++ b/patterns/pyramid_with_numbers.c @@ -15,11 +15,11 @@ int main() void pattern(int x) { int i,j; - for(i=1;i<=x;i++) + for(i=1; i<=x; i++) { - for(j=1;j<=i;j++) + for(j=1; j<=i; j++) { - printf("%d",i); + printf("%d",i); } printf("\n"); } From fe91fddb0787821dd9e17affd56348f1a80485a2 Mon Sep 17 00:00:00 2001 From: Drishty Ganatra <77919644+Drishty06@users.noreply.github.com> Date: Tue, 25 May 2021 16:32:31 +0530 Subject: [PATCH 3/5] Create inverted_half_pyramid.c --- patterns/inverted_half_pyramid.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patterns/inverted_half_pyramid.c diff --git a/patterns/inverted_half_pyramid.c b/patterns/inverted_half_pyramid.c new file mode 100644 index 0000000..1c86825 --- /dev/null +++ b/patterns/inverted_half_pyramid.c @@ -0,0 +1,26 @@ +/* **** + *** + ** + * */ +#include +void pattern(int x); +int main() +{ + int n; + printf("Enter the number of rows "); + scanf("%d",&n); + pattern(n); + return 0; +} +void pattern(int x) +{ + int i,j; + for(i=x; i>=1; i--) + { + for(j=1; j<=i; j++) + { + printf("*"); + } + printf("\n"); + } +} From fcb3fa9d06953154a79de920633af64d7b6a4236 Mon Sep 17 00:00:00 2001 From: Drishty Ganatra <77919644+Drishty06@users.noreply.github.com> Date: Tue, 25 May 2021 16:34:04 +0530 Subject: [PATCH 4/5] Create half_pyramid_progressive_numbers.c --- patterns/half_pyramid_progressive_numbers.c | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patterns/half_pyramid_progressive_numbers.c diff --git a/patterns/half_pyramid_progressive_numbers.c b/patterns/half_pyramid_progressive_numbers.c new file mode 100644 index 0000000..b979bf4 --- /dev/null +++ b/patterns/half_pyramid_progressive_numbers.c @@ -0,0 +1,26 @@ +/*1 + 12 + 123 + 1234*/ +#include +void pattern(int x); +int main() +{ + int n; + printf("Enter the number of rows "); + scanf("%d",&n); + pattern(n); + return 0; +} +void pattern(int x) +{ + int i,j; + for(i=1; i<=x; i++) + { + for(j=1; j<=i; j++) + { + printf("%d",j); + } + printf("\n"); + } +} From 87a4642430b9e04c177b17e8d84cfdc621379102 Mon Sep 17 00:00:00 2001 From: Drishty Ganatra <77919644+Drishty06@users.noreply.github.com> Date: Tue, 25 May 2021 16:40:38 +0530 Subject: [PATCH 5/5] Create equilateral_triangle.c --- patterns/equilateral_triangle.c | 34 +++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 patterns/equilateral_triangle.c diff --git a/patterns/equilateral_triangle.c b/patterns/equilateral_triangle.c new file mode 100644 index 0000000..3ebbab1 --- /dev/null +++ b/patterns/equilateral_triangle.c @@ -0,0 +1,34 @@ +/* * + * * + * * * + * * * * */ + +#include +void pattern(int x); +int main() +{ + int n; + printf("Enter the number of rows "); + scanf("%d",&n); + pattern(n); + return 0; +} +void pattern(int x) +{ + int i, j; + for(i=1; i<=x; i++) + { + for(j=1; j<=x; j++) + { + if(j<=x-i || j>x+i) + { + printf(" "); + } + else + { + printf("* "); + } + } + printf("\n"); + } +}