belongs to collection: Patterns Basic C Programs
#include<conio.h> #include<stdio.h> main() { int len,i,j; int fp,lp; printf("enter no. of lines you want\n"); scanf("%d",&len); printf("\n"); fp = lp = len-1; for(i=0; i<len; i++) { for(j=0; j<2*len-1; j++) { if(j>=fp && j<=lp) printf("*",j); else printf(" "); } fp-- ,lp++; printf("\n"); } }
Output:
enter no. of lines you want
10
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
Output:
enter no. of lines you want
10
*
***
*****
*******
*********
***********
*************
***************
*****************
*******************
need an explanation for this answer? contact us directly to get an explanation for this answer