Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Ficha2Ex5 {
- /**
- * @param args the command line arguments
- */
- public static void main(String[] args) {
- int [][]array = new int [5][10];
- int [][]array2 = new int [5][10];
- int [][]array3 = new int [5][10];
- preenche_array(array);
- escreve_array(array);
- preenche_colcol(array2);
- escreve_array(array2);
- preenche_linlin(array3);
- escreve_array(array3);
- // TODO code application logic here
- }
- static void preenche_array(int [][]array){
- int i,j,x;
- for(j = 0; j < 10; j++ ){
- for(i = 0; i < 5; i++){
- x = (int) (Math.random() * 100);
- array[i][j] = x;
- }
- }
- }
- static void escreve_array(int [][]array){
- int i, j;
- for(j = 0; j < 10; j++){
- for(i = 0; i < 5; i++){
- System.out.println(array[i][j]+" ");
- }
- System.out.println("\n");
- }
- }
- static void preenche_linlin(int [][]array){
- int i,j,aux = 0;
- for(j = 0; j < 10; j++){
- for(i = 0; i < 5; i++){
- array[i][j] = aux;
- aux++;
- }
- }
- }
- static void preenche_colcol(int [][]array){
- int i,j, aux = 0;
- for(i = 0; i < 5; i++){
- for(j= 0; j < 10; j++){
- array[i][j] = aux;
- aux++;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement