0
Hey guys I want help if there is anyone give me example : Array in c sharp like int [ , ] = new int [4,7]; thank you .
3 ответов
+ 3
Here's one
using System;
namespace TwoDArray
{
class Practice
{
static void Main(string[] args)
{
// 2 dimension array (matrix) 4x7
int[ , ] MyArray = new int[ 4, 7 ];
// loop for <Row>
for( int Row = 0, Val = 10; Row < 4; Row++ )
{
// loop for <Col>
for( int Col = 0; Col < 7; Col++, Val += 10 )
{
// Assign and print array elements
MyArray[ Row, Col ] = Val;
Console.Write( "{0} ", MyArray[ Row, Col ] );
}
Console.WriteLine();
}
}
}
}
+ 1
Thank you very much ☺
+ 1
No problem, happy coding 👍