Maya P.

asked • 09/22/20

C# Display a pyramid

Hi!

I have found this code in the internet:

for (int i = 1; i< 10; i++)

{

for(int j= 1; j<= i; j++)

{

Console.Write(i);

}

Console.WriteLine();

}

Console.ReadKey();


This code is used to display a pyramid like this:

1

22

333

4444

55555

666666

7777777

88888888

999999999


But I do not understand the code? Can someone please simplify and explain what it means?


Thankful for your help!

1 Expert Answer

By:

Elliot W. answered • 09/22/20

Tutor
5.0 (207)

Experienced and Successful C Tutor

Maya P.

Amazing thanks!
Report

09/23/20

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.