Question:

My teacher gave me an assingnment to create this figure using loop please help ??

by  |  earlier

0 LIKES UnLike

1

1 2 1

1 2 3 2 1

1 2 3 4 3 2 1

1 2 3 4 5 4 3 2 1

1 2 3 4 3 2 1

1 2 3 2 1

1 2 1

1

Please give me the code to create the above figure using java loops.

 Tags:

   Report

3 ANSWERS


  1. in what programming language? Here, i provide the solution using PHP.

    for($i=1; $i<6; $i++)

    {

    for($j=1; $j<=$i; $j++){echo $j . ' ';}

    for($k=$i-1; $k>=1; $k--){echo $k . ' ';}

    echo "<br>";

    }

    for($i=4; $i>=1; $i--)

    {

    for($j=1; $j<=$i; $j++){echo $j . ' ';}

    for($k=$i-1; $k>=1; $k--){echo $k . ' ';}

    echo "<br>";

    }

    next time, do your own homework.


  2. This is the easiest java homework you will ever get.

  3. Do your own homework.

Question Stats

Latest activity: earlier.
This question has 3 answers.

BECOME A GUIDE

Share your knowledge and help people by answering questions.