#include <stdio.h>
int main(){
int height = 8;//Number of repetitions of basic.
int max_width = height + 1;//Number of block(#) in the largest display
int i, j, w;
for(i = 0; i < height; ++i){
printf("%*s", max_width -(i+2), "");//Print a space in front of the block
for(w = 0; w < i+2; ++w){
printf("#");//display a block of each floor
}
printf("\n");
}
printf("\n");
return 0;
}
#include <stdio.h>
#include <string.h>
int main(){
int height = 8;
int max_width = height + 1;
char wall[max_width + 1];
int i;
memset(wall, '#', sizeof(wall)-1);// make a block of maximum.
wall[sizeof(wall)-1] = '\0';
for(i = 0; i < height; ++i){
printf("%*.*s\n", max_width, i+2, wall);//View of block size and the required blank
}
return 0;
}