Which of the C# code should be added to get the following output? [code] * * * * * * * * * * * * * * * static

Trang Esther

New member
Which of the C# code should be added to get the following output?
Code:
    * * * * *
    * * * *
    * * *
    * *
    *
   static void Main(string[] args)
   {
       int i,j;
     /* Add code here */
  }
A.
Code:
   for (i = 0;i <= 4; i++)
   {
        for(j = 0;j <= 4; j++)
        console.WriteLine("*");
        console.WriteLine("\n");
    }
B.
Code:
   for (i = 0;i <= 4; i++)
   {
        for(j = 4;j <= i; j--)
        console.WriteLine("*");
        console.WriteLine("\n");
   }
C.
Code:
   for (i = 0;i <= 4; i++)
   {
        for (j = i;j <= 4; j++)
        console.WriteLine("*");
        console.WriteLine("\n");
    }
D.
Code:
   for ( i = 0;i <= 4; i++)
   {
        for (j = 0;j <= i; j++)
        console.WriteLine("*");
        console.WriteLine("\n");
    }
 

Tìm kiếm

Back
Top