From 6e2960fd78a0ba9231efb962e806dd6628b39b33 Mon Sep 17 00:00:00 2001 From: Prit Manvar <77919675+pritmanvar@users.noreply.github.com> Date: Tue, 25 May 2021 16:26:05 +0530 Subject: [PATCH 1/4] Create piramid.c This is a pattern for piramid --- patterns/piramid.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 patterns/piramid.c diff --git a/patterns/piramid.c b/patterns/piramid.c new file mode 100644 index 0000000..ff66251 --- /dev/null +++ b/patterns/piramid.c @@ -0,0 +1,26 @@ +/*This is a programe for following star pattern. + * + * * + * * * + * * * * */ +#include +void main() +{ + int n; + printf("Enter the number of rows.\n"); + scanf("%d",&n); + + for(int i = 1;i <= n; i ++) + { + for(int j = 0; j < n-i; j ++) + { + printf(" "); + } + for(int j = 0; j < i; j ++) + { + printf("* "); + } + printf("\n"); + + } +} From d1737bb9e2ed0bcbae4c74f3f570e434152cf9ff Mon Sep 17 00:00:00 2001 From: Prit Manvar <77919675+pritmanvar@users.noreply.github.com> Date: Tue, 25 May 2021 16:26:51 +0530 Subject: [PATCH 2/4] Create number pattern.c --- patterns/number pattern.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patterns/number pattern.c diff --git a/patterns/number pattern.c b/patterns/number pattern.c new file mode 100644 index 0000000..f71aaee --- /dev/null +++ b/patterns/number pattern.c @@ -0,0 +1,22 @@ +/*This is a program to print following pattern. +1 +12 +123 +1234 +12345 */ +#include +void main() +{ + int n; + printf("Enter the number of rows.\n"); + scanf("%d",&n); + + for(int i = 1;i <= n;i++) + { + for(int j = 1;j <= i;j++) + { + printf("%d",j); + } + printf("\n"); + } +} From 79e3e2d1e00c96903f544732ed1336a25e0e9b91 Mon Sep 17 00:00:00 2001 From: Prit Manvar <77919675+pritmanvar@users.noreply.github.com> Date: Tue, 25 May 2021 16:28:07 +0530 Subject: [PATCH 3/4] Create Reverse number pattern.c --- patterns/Reverse number pattern.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 patterns/Reverse number pattern.c diff --git a/patterns/Reverse number pattern.c b/patterns/Reverse number pattern.c new file mode 100644 index 0000000..51701c6 --- /dev/null +++ b/patterns/Reverse number pattern.c @@ -0,0 +1,22 @@ +/*This is a program to print following pattern. +12345 +1234 +123 +12 +1 */ +#include +void main() +{ + int n; + printf("Enter the number of rows.\n"); + scanf("%d",&n); + + for(int i = n;i > 0;i--) + { + for(int j = 1;j <= i;j++) + { + printf("%d",j); + } + printf("\n"); + } +} From f9b2b2d06309fab7bfea1afb721c04f3588d7f8f Mon Sep 17 00:00:00 2001 From: Prit Manvar <77919675+pritmanvar@users.noreply.github.com> Date: Tue, 25 May 2021 16:29:13 +0530 Subject: [PATCH 4/4] Create Character Pattern.c --- patterns/Character Pattern.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 patterns/Character Pattern.c diff --git a/patterns/Character Pattern.c b/patterns/Character Pattern.c new file mode 100644 index 0000000..fae30bd --- /dev/null +++ b/patterns/Character Pattern.c @@ -0,0 +1,32 @@ +/*AAAAA + BBBB + CCC + DD + E */ +#include +void main() +{ + int n,x=65; + printf("Enter the number of rows which should be less than 26.\n"); + start: + scanf("%d",&n); + + if (n<27) + { + for(int i = n; i > 0;i--) + { + for(int j = i;j > 0; j--) + { + printf("%c",x); + } + x +=1; + printf("\n"); + } + } + else + { + printf("Invalid input.\n"); + printf("Enter the number of rows again.\n"); + goto start; + } +}