Created
June 5, 2018 07:07
-
-
Save sagardere/963f7fc46a56d55423e9ee504133e681 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
void main() | |
{ | |
int rows,starNo,spaceNo; | |
printf("Enter Rows:\n"); | |
scanf("%d",&rows); | |
for(int i=1;i<=rows;i++) | |
{ | |
starNo=i*2-1; | |
spaceNo=i+rows-starNo; | |
for(int j=0;j<spaceNo;j++) | |
{ | |
printf("%c",' '); | |
} | |
for(int k=0;k<starNo;k++) | |
{ | |
printf("%c",'*'); | |
} | |
printf("\n"); | |
} | |
for(int l=0;l<3;l++) | |
{ | |
for(int m=0;m<(rows*2+1)/2;m++) | |
{ | |
printf("%c",' '); | |
} | |
printf("%c\n",'*'); | |
} | |
} | |
/* | |
I/P : Enter Rows: 7 | |
O/P : | |
* | |
*** | |
***** | |
******* | |
********* | |
*********** | |
************* | |
* | |
* | |
* | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment