2012년 7월 2일 월요일

N x N java source


n x n matrix java source


import java.util.Random;
public class Matrix{

public static void main(String[] args){

int a = Integer.parseInt(args[0]);
int b = Integer.parseInt(args[1]);
int c = Integer.parseInt(args[2]);
int[][] xx = new int[a][b];
int[][] yy = new int[b][c];
int[][] complete = new int[a][c];

Random rand = new Random();
for(int i =0; i for (int j =0; j xx[i][j]=(rand.nextInt()%11);
}
}
for(int i =0; i for (int j =0; j yy[i][j]=(rand.nextInt()%11);
}
}

int temp=0;

int t=0;

for(int i =0; i for(int j =0; j temp =(xx[i][j]*yy[j][i])+temp;
complete[i][t]=temp;
}
t++;
temp=0;
}

for(int i =0; i for(int k =a-1; k>=0; k--){
for(int j =0; j temp =(xx[i][j]*yy[j][k])+temp;
complete[i][k]=temp;
}
temp=0;
}}



System.out.println("Matrix A:");
for(int i =0; i for(int j =0; j System.out.print(xx[i][j]+" ");
}
System.out.println();
}

System.out.println("Matrix B:");
for(int i =0; i for(int j =0; j System.out.print(yy[i][j]+" ");
}
System.out.println();
}

System.out.println("Matrix :");
for(int i =0; i for(int j =0; j System.out.print(complete[i][j]+" ");
}
System.out.println();
}
}
}

댓글 없음:

댓글 쓰기

국정원의 댓글 공작을 지탄합니다.

UPBIT is a South Korean company, and people died of suicide cause of coin investment.

 UPBIT is a South Korean company, and people died of suicide cause of coin. The company helps the people who control the market price manipu...