Puzzle L34


Left Pyramid

[E-5]Write a function that prints a pyramid of B blocks. Each block is an N by 2N-1 rectangle, starting with N=1 and going up to N=B:

*
***
***
*****
*****
*****
*******
*******
*******
*******
*********
*********
*********
*********
*********
***********
***********
***********
***********
***********
***********

Use the previous function starBlock(), to build the pyramid.

#include <stdio.h>

void starLine( int n )
{
}

void starBlock( int rows, int cols )
{
}

void pyramid( int blocks )
{
}

int main()
{
  pyramid( 7 );  	
  return 0;
}


Previous Page        Answer         Next Page         Home