pattern program 4
Program - 4
/*C program to print following Pyramid: * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ #include<stdio.h> #define MAX 5 int main() { int i,j; int space=4; /*run loop (parent loop) till number of rows*/ for(i=0;i< MAX;i++) { /*loop for initially space, before star printing*/ for(j=0;j< space;j++) { printf(" "); } for(j=0;j<=i;j++) { printf("* "); } printf("\n"); space--; } /*repeat it again*/ space=0; /*run loop (parent loop) till number of rows*/ for(i=MAX;i>0;i--) { /*loop for initially space, before star printing*/ for(j=0;j< space;j++) { printf(" "); } for(j=0;j< i;j++) { printf("* "); } printf("\n"); space++; } return 0; }
Output
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
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.
Program - 4
Output
need an explanation for this answer? contact us directly to get an explanation for this answer