Ahmet Taha

Ahmet Taha

  • NA
  • 381
  • 18.1k

c# console problem 101

Oct 14 2021 2:41 PM

Good Day Mr. Sachin Singh

Could you solved this ?

The output is like this:

*******

*****

***

*

Here is my code

int y;
for (int x = 0; x < 7; x++)
{
    for (y = 0; y <= x; y++)
    {
        //if (y==0 || y==x || x==16)
        if (y % 2==0)
        {
            Console.Write("");
        }
        else
        {
            Console.Write("*");
        }
    }
    Console.Write("\n");
}

Answers (7)