Main.cs
using
System;
class
Program {
-
public
static
int
Main() {
-
int
[,] ara =
new
int
[2, 3] { { 1, 3, 5 }, { 10, 20, 30 } };
-
int
res1 = 0;
-
for
(
int
i=0; i<2; i++) {
-
for
(
int
j=0; j<3; j++) {
-
res1+=ara[i, j];
-
}
-
}
-
Console.WriteLine(res1);
-
int
res2 = 0;
-
foreach
(var i
in
ara) {
-
res2+=i;
-
}
-
Console.WriteLine(res2);
-
Console.ReadKey();
-
return
0;
-
}
}
using
System;
class
Program {
-
public
static
int
Main() {
-
int
[,] ara =
new
int
[2, 3] { { 1, 3, 5 }, { 10, 20, 30 } };
-
int
res1 = 0;
-
for
(
int
i=0; i<2; i++) {
-
for
(
int
j=0; j<3; j++) {
-
res1+=ara[i, j];
-
}
-
}
-
Console.WriteLine(res1);
-
int
res2 = 0;
-
foreach
(var i
in
ara) {
-
res2+=i;
-
}
-
Console.WriteLine(res2);
-
Console.ReadKey();
-
return
0;
-
}
}
69
69
69