Hey guys I want help if there is anyone give me example : Array in c sharp like int [ , ] = new int [4,7]; thank you . | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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 .

2nd Apr 2021, 6:51 PM
Eymen Kassar
3 Answers
+ 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(); } } } }
2nd Apr 2021, 10:06 PM
Ipang
+ 1
Thank you very much ☺
2nd Apr 2021, 10:14 PM
Eymen Kassar
+ 1
No problem, happy coding 👍
2nd Apr 2021, 10:15 PM
Ipang