Jadval hosil qiling va unga ma’lumotlarni


Download 22.56 Kb.
Sana18.11.2023
Hajmi22.56 Kb.
#1785722
Bog'liq
Jadval hosil qiling va unga ma’lumotlarni kiriting, ekranga chiqaring


Jadval hosil qiling va unga ma’lumotlarni kiriting, ekranga chiqaring.
package com.company;
import java.util.Scanner;
public class Matrix {

public static void main(String[] args) {
Scanner string = new Scanner(System.in);
String[][] matrix = null;
int qator = 0;
int ustun = 0;
Scanner scanner = new Scanner(System.in);
System.out.print("Qator va ustunlarni kiriting : ");
qator = scanner.nextInt();
ustun = scanner.nextInt();
matrix = new String[qator][ustun];
System.out.println("Mattritaningementlarini kiriting ");
for (int i = 0; i < qator; i++) {
for (int j = 0; j < ustun; j++) {
System.out.print("Element[" + i + "][" + j + "]: ");
matrix[i][j] = string.nextLine();
}
}
System.out.println("\nJadval ");
for (String[] i : matrix) {
for (String j : i) {
System.out.print(j + " ");
}
System.out.println();
}
}
}

Download 22.56 Kb.

Do'stlaringiz bilan baham:




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