Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public class Program
- {
- public static double[,] odejmijzera(double [,] T){
- Console.WriteLine();
- int y;
- double[,] T2= new double [T.GetLength(0)-1,T.GetLength(1)-1];
- for(int i=0;i<T.GetLength(0);i++){
- Console.WriteLine();
- y=0;
- for(int j=0;j<T.GetLength(1);j++){
- if(T[i,j]!=0){
- //T2[i-1,j]=T[i-1,j];
- T2[i-1,y]=T[i,j];
- //Console.WriteLine("x:"+i+" y:"+j);
- y++;
- }
- }
- }return T2;
- }
- public static double wyznacznik2x2(double[,]T){
- double wyznacznik=5;
- wyznacznik=T[0,0]*T[1,1]-T[0,1]*T[1,0];
- return wyznacznik;
- }
- public static double[,] pomniejszMtx(int x,double [,]T){
- double[,] Tab2= new double [T.GetLength(0),T.GetLength(0)];
- int wielkosc=T.GetLength(0);
- for(int i=1;i<wielkosc;i++){
- for(int j=0;j<wielkosc;j++){
- if(j!=x){
- Tab2[i,j]=T[i,j];
- }
- }
- }
- return odejmijzera(Tab2);
- }
- public static void wyswietlMtx(double [,] T){
- Console.WriteLine();
- for(int i=0;i<T.GetLength(0);i++){
- Console.WriteLine();
- for(int j=0;j<T.GetLength(1);j++){
- Console.Write("\t"+ T[i,j]);
- }
- }
- }
- public static void Main()
- {
- double[,] Tab={{1,2,3,5},{4,5,6,5}, {9,8,7,5},{1,3,6,2}};
- double [,] Tab2={{1,2},{4,5}};
- wyswietlMtx(Tab);
- wyswietlMtx(pomniejszMtx(0,Tab));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement