Advertisement
Guest User

Maciarzki

a guest
Nov 20th, 2019
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. public class Program
  5. {
  6. public static double[,] odejmijzera(double [,] T){
  7. Console.WriteLine();
  8. int y;
  9. double[,] T2= new double [T.GetLength(0)-1,T.GetLength(1)-1];
  10. for(int i=0;i<T.GetLength(0);i++){
  11. Console.WriteLine();
  12. y=0;
  13. for(int j=0;j<T.GetLength(1);j++){
  14. if(T[i,j]!=0){
  15.  
  16. //T2[i-1,j]=T[i-1,j];
  17. T2[i-1,y]=T[i,j];
  18. //Console.WriteLine("x:"+i+" y:"+j);
  19. y++;
  20. }
  21. }
  22. }return T2;
  23. }
  24.  
  25. public static double wyznacznik2x2(double[,]T){
  26. double wyznacznik=5;
  27. wyznacznik=T[0,0]*T[1,1]-T[0,1]*T[1,0];
  28. return wyznacznik;
  29. }
  30.  
  31. public static double[,] pomniejszMtx(int x,double [,]T){
  32. double[,] Tab2= new double [T.GetLength(0),T.GetLength(0)];
  33. int wielkosc=T.GetLength(0);
  34.  
  35. for(int i=1;i<wielkosc;i++){
  36. for(int j=0;j<wielkosc;j++){
  37. if(j!=x){
  38. Tab2[i,j]=T[i,j];
  39. }
  40.  
  41.  
  42.  
  43.  
  44. }
  45. }
  46. return odejmijzera(Tab2);
  47. }
  48.  
  49.  
  50.  
  51.  
  52. public static void wyswietlMtx(double [,] T){
  53. Console.WriteLine();
  54. for(int i=0;i<T.GetLength(0);i++){
  55. Console.WriteLine();
  56. for(int j=0;j<T.GetLength(1);j++){
  57. Console.Write("\t"+ T[i,j]);
  58. }
  59. }
  60. }
  61.  
  62. public static void Main()
  63. {
  64.  
  65. double[,] Tab={{1,2,3,5},{4,5,6,5}, {9,8,7,5},{1,3,6,2}};
  66. double [,] Tab2={{1,2},{4,5}};
  67. wyswietlMtx(Tab);
  68. wyswietlMtx(pomniejszMtx(0,Tab));
  69.  
  70.  
  71.  
  72. }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement