Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.22 KB | None | 0 0
  1. namespace ConsoleApplication1
  2. {
  3.     class Program
  4.     {
  5.         public static void output(int[] a)
  6.         {
  7.             int i;
  8.             for (i = 0; i < a.Length; i++)
  9.                 Console.WriteLine(a[i]);
  10.         }
  11.         public static int numbox(int[,] a)
  12.         {
  13.             int x;
  14.             x = a.GetLength(0) * a.GetLength(1);
  15.             return x;
  16.         }
  17.         public static int[] chiburarr(int[,] a,int numbox)
  18.         {
  19.             int [] b=new int[numbox];
  20.             int i=0,row=0,col=0;
  21.             for (row = 0; row < a.GetLength(0); row++)
  22.                 for (col = 0; col < a.GetLength(1); col++)
  23.                 {
  24.                     b[i] = a[row, col];
  25.                     i++;
  26.                 }
  27.             return b;
  28.         }
  29.         public static bool difcheck(int[] a)
  30.         {
  31.             bool ok = true;
  32.             int i, j;
  33.             for (i = 0; i < a.Length; i++)
  34.             {
  35.                 for (j = i + 1; j < a.Length; j++)
  36.                 {
  37.                     if (a[i] == a[j])
  38.                         ok = false;
  39.                 }
  40.             }
  41.             return ok;
  42.         }
  43.        
  44.         public static void input2(int[,] a)
  45.         {
  46.             int col,row;
  47.             for (row = 0; row < a.GetLength(0); row++)
  48.             {
  49.                 for (col = 0; col < a.GetLength(1); col++)
  50.                     a[row, col] = int.Parse(Console.ReadLine());
  51.             }
  52.         }
  53.         public static void output2(int[,] a)
  54.         {
  55.             int col, row;
  56.             for (row = 0; row < a.GetLength(0); row++)
  57.             {
  58.                 for (col = 0; col < a.GetLength(1); col++)
  59.                 {
  60.                     Console.Write(a[row, col]);
  61.                 }
  62.                 Console.WriteLine(" ");
  63.             }
  64.         }
  65.         static void Main(string[] args)
  66.         {
  67.             int[,]a=new int[3,3];
  68.             int[] b = new int[numbox(a)];
  69.             int x;
  70.             input2(a);
  71.             Console.WriteLine(numbox(a));
  72.             b=chiburarr(a,numbox(a));
  73.             Console.WriteLine(b);
  74.             Console.WriteLine(difcheck(b));
  75.            
  76.             x = int.Parse(Console.ReadLine());
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement