From f78f9bc0053679bfc355979df58106fd606f4910 Mon Sep 17 00:00:00 2001 From: KratoSkills <56100874+KratoSkills@users.noreply.github.com> Date: Thu, 17 Oct 2019 10:07:14 +0530 Subject: [PATCH] Update Pyramid.c --- Source codes/Pyramid.c | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/Source codes/Pyramid.c b/Source codes/Pyramid.c index 39ed8ba..f00c715 100644 --- a/Source codes/Pyramid.c +++ b/Source codes/Pyramid.c @@ -1,20 +1,13 @@ #include -main() -{ +main() { int i,j,k,n; - printf("enter the number of rows to be printed: "); - scanf("%d",&n); - for(i=1;i<=n;i++) - { - for(j=1;j<=n-i;j++) - printf(" "); - { - for(k=1;k<=i;k++) - if(i<10) - printf(" %d ", i); - else - printf("%d ", i); - } - printf("\n"); + printf("Enter the number of rows to be printed: "); + scanf(" %d",&n); + for(i=1;i<=n;i++) { + for(j=0;j<=n-i;j++) + printf(" "); + for(k=1;k<=(2*i);k++) + printf("%d", i); + printf("\n"); } }