From 474cbc8cb1eb76a30c37a622463cf1098e25ef63 Mon Sep 17 00:00:00 2001 From: Adityashri24 Date: Fri, 18 Nov 2022 16:43:52 +0530 Subject: [PATCH] adding a c file of pattern --- pattern.txt | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 pattern.txt diff --git a/pattern.txt b/pattern.txt new file mode 100644 index 0000000..045cb7d --- /dev/null +++ b/pattern.txt @@ -0,0 +1,27 @@ +#include + +int main() +{ + int n,m; + printf("Enter the number of rows"); + scanf("%d",&n); + m=n; + for(int i=1;i<=n;i++) + { + for(int j=1;j<=m-1;j++) + { + printf(" "); + } + for(int k=1;k<=2*i-1;k++) + { + if(k==1 || k==2*i-1 || i==n) + printf("*"); + else + printf(" "); + } + m--; + + printf("\n"); + } + return 0; +} \ No newline at end of file