Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class MyProgram
- {
- private static Random random = new Random();
- public static void Main(string[] args)
- {
- int n, m, i, j;
- string sz;
- n = 4;
- sz = "";
- m = 8;
- int[] t = new int[n * m];
- for (i = 0; i <= n - 1; i++)
- {
- for (j = 0; j <= m - 1; j++)
- {
- t[i * m + j] = random.Next(9);
- Console.Write(t[i * m + j].ToString() + " ");
- sz = sz + "--";
- }
- Console.WriteLine("");
- }
- Console.WriteLine(sz);
- for (j = 0; j <= m - 1; j++)
- {
- for (i = 0; i <= n - 1; i++)
- {
- if (j % 2 == 0)
- {
- Console.Write(t[i * m + j].ToString() + " ");
- }
- else
- {
- Console.Write(t[(n - 1 - i) * m + j].ToString() + " ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement