Advertisement
Guest User

Untitled

a guest
Jan 24th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.70 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication1._17
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[,] tomb = new int[5 , 10];
  14.             feltoltes(tomb);
  15.             kiiras(tomb);
  16.             feltolt(tomb);
  17.             kiiras(tomb);
  18.             int[,] tomb1 = new int[10, 10];
  19.             feltoltes3(tomb1);
  20.             kiiras3(tomb1);
  21.             Console.ReadKey();
  22.         }
  23.         static void feltoltes(int[,] vektor)
  24.         {
  25.             Random rnd = new Random();
  26.             for (int x = 0; x < 5; x++)
  27.             {
  28.                 for (int i = 0; i < 10; i++)
  29.                 {
  30.                     vektor[x, i] = rnd.Next(101);
  31.                 }
  32.             }
  33.         }
  34.         static void kiiras(int[,] iras)
  35.         {
  36.             for (int x = 0; x < 5; x++)
  37.             {
  38.                 for (int i = 0; i < 10; i++)
  39.                 {
  40.                     Console.Write("{0,4}", iras[x,i] + " ");
  41.                 }
  42.                 Console.WriteLine();
  43.             }
  44.             Console.WriteLine();
  45.             Console.WriteLine();
  46.         }
  47.  
  48.         static void kiiras3(int[,] iras)
  49.         {
  50.             for (int x = 0; x < 10; x++)
  51.             {
  52.                 for (int i = 0; i < 10; i++)
  53.                 {
  54.                     Console.Write("{0,4}", iras[x, i] + " ");
  55.                 }
  56.                 Console.WriteLine();
  57.             }
  58.             Console.WriteLine();
  59.             Console.WriteLine();
  60.         }
  61.  
  62.         static void feltolt(int[,] iras)
  63.         {
  64.             int x = 0;
  65.             for (x = 0; x < 5; x++)
  66.             {
  67.                 for (int i = 0; i < 10; i++)
  68.                 {
  69.                     if (x == 0 || x == 2 || x == 4)
  70.                     {
  71.                         iras[x, i] = 1;
  72.                     }
  73.                     else
  74.                     {
  75.                         iras[x, i] = 0;
  76.                     }
  77.                 }
  78.             }
  79.         }
  80.      
  81.         static void feltoltes3(int[,] kk)
  82.         {
  83.             Random rnd = new Random();
  84.             for (int i = 0; i < 10; i++)
  85.             {
  86.                 for (int j = 0; j < 10; j++)
  87.                 {
  88.                     if (i == j)
  89.                     {
  90.                         kk[i,j] = 1;
  91.                     }
  92.                     else if (i < j)
  93.                     {
  94.                         kk[i, j] = 1;
  95.                     }
  96.                     else
  97.                     {
  98.                         kk[i, j] = 0;
  99.                     }
  100.                 }
  101.             }
  102.         }
  103.       }
  104.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement