SHOW:
|
|
- or go back to the newest paste.
1 | using System; | |
2 | ||
3 | namespace C_sharp_Light | |
4 | { | |
5 | class Program | |
6 | { | |
7 | static void Main(string[] args) | |
8 | { | |
9 | - | |
9 | + | Random rand = new Random(); |
10 | int[,] array = new int[5, 5]; | |
11 | ||
12 | for (int x = 0; x < array.GetLength(0); x++) | |
13 | { | |
14 | for (int y = 0; y < array.GetLength(1); y++) | |
15 | { | |
16 | array[x, y] = rand.Next(0, 10); | |
17 | Console.Write(array[x, y] + " "); | |
18 | } | |
19 | Console.WriteLine(""); | |
20 | } | |
21 | Console.WriteLine("\n\n"); | |
22 | ||
23 | int sum = 0; | |
24 | for (int i = 0; i < array.GetLength(1); i++) | |
25 | { | |
26 | if(i==array.GetLength(1)-1) | |
27 | Console.Write(array[1, i]); | |
28 | else | |
29 | Console.Write(array[1, i]+"+"); | |
30 | sum += array[1, i]; | |
31 | } | |
32 | Console.Write("=" + sum+"\n\n"); | |
33 | ||
34 | int multiplication = 1; | |
35 | for (int i = 0; i < array.GetLength(0); i++) | |
36 | { | |
37 | if (i == array.GetLength(0)-1) | |
38 | Console.Write(array[i, 0]); | |
39 | else | |
40 | Console.Write(array[i, 0] + "*"); | |
41 | multiplication *= array[i, 0]; | |
42 | } | |
43 | Console.Write("=" + multiplication + "\n\n"); | |
44 | ||
45 | Console.ReadKey(); | |
46 | } | |
47 | } | |
48 | } |