Baklava

Published on 17 September 2018 (Updated: 20 November 2024)

Welcome to the Baklava page! Here, you'll find a description of the project as well as a list of sample programs written in various languages.

This article was written by:

Description

Baklava is a Turkish dessert, and its shape is like an equilateral quadrangle. It is used as an example for programming education in Turkish schools.

In general, this solution can be accomplished using a pair of loops. Of course, all possible programs are welcome.

Requirements

For simplicity, Baklava requires no inputs and can be executed in some form as follows:

$ ./baklava.lang

The following is the expected output:

           *
          ***
         *****
        *******
       *********
      ***********
     *************
    ***************
   *****************
  *******************
 *********************
  *******************
   *****************
    ***************
     *************
      ***********
       *********
        *******
         *****
          ***
           *
  1. The shape should be symmetrical both horizontally and vertically
  2. Each subsequent line should either add or remove padding by one character on both sides
  3. Whitespace should be adjusted accordingly in order to properly output the shape

Testing

Verify that the actual output matches the expected output (see Requirements).

Articles

There are 74 articles: