Advertisement
Guest User

Untitled

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