c code to print pattern of Star | C Program to Print pyramid of stars in C | Pyramid of stars in C | Printing pyramid of asterisk in C
#includemain() { int n, c, k = 2, j; printf("Enter number of rows\n"); scanf("%d",&n); for ( j = 1 ; j <= n ; j++ ) { for ( c = 1 ; c <= 2*n-k ; c++) printf(" "); k = k + 2; for ( c = 1 ; c <= j ; c++) printf("* "); printf("\n"); } getch(); return 0; } OUTPUT : * * * * * * * * * *
No comments:
Post a Comment