CONVERT to C# C# C# C# Just need C and Dpublic class Patterns { public static void main(String[]args) { char[][] arr=new char[10][10]; int starCount = 10; for(int i=0; i }}Need this code converted to "C# C# C# C# C# Just need C and D

Respuesta :

Answer:

following are converted C# code:

using System; //import System

class Patterns //defining class Pattern

{

public static void Main() //defining main method

{

char[,] arr=new char[10,10];//defining char array  

int starCount = 10;//defining integer variable starCount that holds value

int c=starCount;//defining integer variable c that holds starCount value  

for(int i=0; i<c;i++,starCount--)//defining loop for column  

{

for(int j=0; j<i; j++)//defining loop for rows

{

arr[i,j]='_'; //holds underscore value

}

for(int k=i; k<c; k++)//defining loop for rows  

{

arr[i,k]='*';//holds asterik value

}

}

for(int a=0; a<c; a++)//defining loop for print column value

{

for(int b=0;b<c;b++) //defining loop for print row value

{

Console.Write(arr[a,b]);//print value

}

Console.WriteLine();//print space value

}

}

}

Output:

please find the attachment.

Explanation:

In the above given C# language code, firstly we import the package system, in the next step, Patters is declared, inside the class a char array "arr" and integer variable "starCount" is declared, that store integer value and the main method is declared.

In the method, for loop is defined, inside the loop, it stores "underscore and asterisk" value in the array.

Outside to loop another loop is defined, which uses the print method to print its value.    

Ver imagen codiepienagoya
ACCESS MORE