Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication1._17
- {
- class Program
- {
- static void Main(string[] args)
- {
- int[,] tomb = new int[5 , 10];
- feltoltes(tomb);
- kiiras(tomb);
- feltolt(tomb);
- kiiras(tomb);
- int[,] tomb1 = new int[10, 10];
- feltoltes3(tomb1);
- kiiras3(tomb1);
- Console.ReadKey();
- }
- static void feltoltes(int[,] vektor)
- {
- Random rnd = new Random();
- for (int x = 0; x < 5; x++)
- {
- for (int i = 0; i < 10; i++)
- {
- vektor[x, i] = rnd.Next(101);
- }
- }
- }
- static void kiiras(int[,] iras)
- {
- for (int x = 0; x < 5; x++)
- {
- for (int i = 0; i < 10; i++)
- {
- Console.Write("{0,4}", iras[x,i] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine();
- }
- static void kiiras3(int[,] iras)
- {
- for (int x = 0; x < 10; x++)
- {
- for (int i = 0; i < 10; i++)
- {
- Console.Write("{0,4}", iras[x, i] + " ");
- }
- Console.WriteLine();
- }
- Console.WriteLine();
- Console.WriteLine();
- }
- static void feltolt(int[,] iras)
- {
- int x = 0;
- for (x = 0; x < 5; x++)
- {
- for (int i = 0; i < 10; i++)
- {
- if (x == 0 || x == 2 || x == 4)
- {
- iras[x, i] = 1;
- }
- else
- {
- iras[x, i] = 0;
- }
- }
- }
- }
- static void feltoltes3(int[,] kk)
- {
- Random rnd = new Random();
- for (int i = 0; i < 10; i++)
- {
- for (int j = 0; j < 10; j++)
- {
- if (i == j)
- {
- kk[i,j] = 1;
- }
- else if (i < j)
- {
- kk[i, j] = 1;
- }
- else
- {
- kk[i, j] = 0;
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement