Search Results

Search found 3 results on 1 pages for 'baiba'.

Page 1/1 | 1 

  • two dimensional array [closed]

    - by Baiba
    Can someone please write to me source code in Java? I have a task: create a program, that contains two dimensional array (with numbers) and the programm needs to sum zeros in each column and then get out the number of column in which the zeros are least.. thanks!

    Read the article

  • java programming

    - by Baiba
    ok i have version of t code, please tell me what i need to do when i need to get out of program The INDEX NUMBER OF COLUMN IN WHICH ARE LEAST ZEROS? class Uzd{ public static void main(String args[]){ int mas[][]= {{3,4,7,5,0}, {4,5,3,0,1}, {8,2,4,0,3}, {7,0,2,0,1}, {0,0,1,3,0}}; int nul_mas[] = new int[5]; int nul=0; for(int j=0;j<5;j++){// nul=0; for(int i=0;i<5;i++){ if(mas[i][j]==0){ nul++; } } nul_mas[j]=nul; } for(int i=0;i<5;i++){ for(int j=0;j<5;j++){ System.out.print(mas[i][j]); } System.out.println(); } System.out.println();// atstarpe System.out.println("///zeros in each column///"); for(int i=0;i<5;i++){System.out.print(nul_mas[i]);} System.out.println(); }} and after running it shows: 34750 45301 82403 70201 00130 ///zeros in each column/// But i need not in each column but i need to get out index of column in which zeros are least! in this situation it is column nubmer 2!! 12032

    Read the article

  • Please help with my twodimensional array source code

    - by Baiba
    Here is what i have done but i have some questions: class masivins { public static void main (String args[]) { int mas[][] = {{0, 2, 7, 0, 8, 5, 3}, {0, 4, 0, 6, 0, 0, 0}, {0, 0, 0, 0, 3, 0, 0}, {7, 0, 0, 9, 1, 0, 7}, {5, 0, 4, 0, 0, 2, 0}}; int nulmas[] = new int [7]; int nul=0; for(int j=0; j<7; j++) { nul=0; for(int i=0; i<5; i++) { if(mas[i][j]==0) { nul++; } } nulmas[j]=nul; } for(int i=0; i<5; i++) { for(int j=0; j<7; j++) { System.out.println(mas[i][j]); } System.out.println(); } System.out.println(); for(int i=0; i<5; i++) { System.out.println("Zeros in each array column: " + nulmas[i]); } System.out.println(); } } so my questions are: 1) why after running project there are only 5 "Zeros in each array column....." shown? 2) what and where i need to change in this code to get out the number of column in which zeros are least?

    Read the article

1