Puzzle L18


Print a wedge of stars

[E-7] Write a main() program that prints a wedge of stars. Print n stars in row 0, (n-1) stars in row 1, (n-2) stars in row 2, and so on. Here is what this looks like:

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

The first star in each line starts in column zero (this is not clear from the above picture.)

Here is a Skeleton:

#include <stdio.h>
#include <stdlib.h>

/* Puzzle L18 -- print a wedge of stars, n stars in the first row
|
|  Decrease the number of stars per row until the final row
|  has one star.
*/
int main()
{
  int row, col;
  int n=15 ;
  
  for (   )
  {
    for (   )
      printf( );
    printf( );
  }
  
  
  return 0;
}



Previous Page        Answer         Next Page         Home