Programming Language/이것이 C# 연습문제 풀이
이것이 C# 10장 연습문제 풀이
dbxxrud
2019. 5. 13. 01:21
1.
string 형식을 int 로 변환할수 없습니다.
2.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
using System;
using static System.Console;
namespace Practice2
{
class MainApp
{
public static void Main()
{
int[,] A = new int[2, 2] { { 3, 2 }, { 1, 4 } };
int[,] B = new int[2, 2] { { 9, 2 }, { 1, 7 } };
int[,] Result = new int[2, 2]
{
{(A[0 , 0] * B[0 , 0]) + (A[0 , 1] * B[1 , 0]) , (A[ 0 , 0] * B[0 , 1]) + (A[0 , 1] * B[1 , 1]) } ,
{(A[1 , 0] * B[0 , 0]) + (A[1 , 1] * B[1 , 0]) , (A[ 1 , 0] * B[0 , 1]) + (A[1 , 1] * B[1 , 1]) }
};
for (int i = 0; i < Result.GetLength(0); ++i)
{
for (int j = 0; j < Result.GetLength(1); ++j)
WriteLine($"[{i},{j}] : {Result[i, j]}");
}
}
}
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4f; text-decoration:none">Colored by Color Scripter
|
http://colorscripter.com/info#e" target="_blank" style="text-decoration:none; color:white">cs |
3.
5 4 3 2 1
4.
1 2 3 4 5
5.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
using System;
using static System.Console;
using System.Collections;
namespace Practice2
{
class MainApp
{
public static void Main()
{
Hashtable ht = new Hashtable();
ht["회사"] = "Microsoft";
ht["URL"] = "www.microsoft.com";
WriteLine("회사 : {0}", ht["회사"]);
WriteLine("URL : {0}", ht["URL"]);
}
}
}
|