Advertisement
Guest User

Untitled

a guest
Jan 23rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. int w = int.Parse(Console.ReadLine());
  2. int k = int.Parse(Console.ReadLine());
  3. int[,] macierz = new int[w,k];
  4. int c = 0;
  5. for (int z = 0; z < w; z++)
  6. {
  7. for (int v = 0; v < k; v++)
  8. {
  9. macierz[z, v] = int.Parse(Console.ReadLine());
  10. }
  11. }
  12.  
  13.  
  14. for (int x = 0; x < w; x++)
  15.  
  16. {
  17. for (int y = 0; y < k; y++)
  18. {
  19.  
  20. Console.Write(macierz[x, y] + "\t");
  21.  
  22. if (macierz[x, x] == 1)
  23. {
  24. if (macierz[x, y] == 0)
  25. {
  26.  
  27. c++;
  28. }
  29.  
  30. }
  31.  
  32. }
  33. Console.WriteLine();
  34. }
  35. if (c == (macierz.Length - w))
  36. {
  37. Console.WriteLine("Macierz jednostkowa");
  38. }
  39. else
  40. {
  41. Console.WriteLine("Macierz nie jest jednostkowa");
  42. }
  43. Console.WriteLine(w);
  44. Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement