1-mustaqil ishi


Download 132.48 Kb.
Sana25.10.2023
Hajmi132.48 Kb.
#1719799
Bog'liq
Azizbek 1-mustaqil ishi


1-mustaqil ishi
Qism dasturdan foydalanib matrisa ustida kuyidagi amallar bajarilsin: matrisani juft kator elementlarini ko‘paytmasi; tok kator elementlarini yigindisi; juft elementlardan eng kattasi.









import java.util.Scanner;


public class MustaqilIsh1 {
public static void main(String[] args) {

Scanner scanner = new Scanner(System.in);


int n = scanner.nextInt(), m = scanner.nextInt();
int[][] a = new int[n][m];
for(int i=0; ifor(int j=0; ja[i][j] = scanner.nextInt();
}
}
for(int i=0; ifor(int j=0; jSystem.out.print(a[i][j] + " ");
}
System.out.println();
}
for(int i=0; iint kopaytma = 1;
for(int j=0; jif(i%2==0){
kopaytma *= a[i][j];
}
}
System.out.println(i + " juft qator kopaytma " + kopaytma);
}

for(int i=0; i
int yigindi = 0;
for(int j=0; jif(i%2!=0){
yigindi += a[i][j];
}
}
System.out.println(i + " toq qator yig'indi " + yigindi);
}
int mx = a[1][1];
for(int i=0; ifor(int j=0; jif(a[i][j]%2==0){
if(mx < a[i][j])
mx = a[i][j];
}
}
}
System.out.println("Juft elementlardan eng kattasi: " + mx);
}
}

Download 132.48 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©fayllar.org 2024
ma'muriyatiga murojaat qiling