adplus-dvertising
frame-decoration

Question

Which of the code should be added to get the following output?
* * * * *
    * * * *
    * * *
    * *
    *
   static void Main(string[] args)
   {
       int i,j;
     /* Add code here */
 
  }

a.

for (i = 0;i <= 4; i++)
{
for(j = 4;j <= i; j–)
console.WriteLine(“*”);
console.WriteLine(“\n”);
}

b.

for (i = 0;i <= 4; i++)

c.

for (i = 0;i <= 4; i++)
{
for (j = i;j <= 4; j++)
console.WriteLine(“*”);
console.WriteLine(“\n”);
}

d.

for ( i = 0;i <= 4; i++)
{
for (j = 0;j <= i; j++)
console.WriteLine(“*”);
console.WriteLine(“\n”);
}

Posted under C# programming

Answer: for (i = 0;i <= 4; i++)
{
for(j = 0;j <= 4; j++)
console.WriteLine(“*”);
console.WriteLine(“\n”);
}

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. Which of the code should be added to get the following output?