Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Dịch hơi ngáo :v Mấy cái hàm copy hết qua xong sửa lại :)))
$\\$
import java.util.Scanner;
public class Main {
int MAX = 100;
int a[][] = new int[MAX][MAX], dong, cot;
/// Mấy hàm này copy xong sửa lại thôi :D
private void NhapMang() {
Scanner stdin = new Scanner(System.in);
do
{
System.out.printf("\nNhap vao so dong: ");
dong = stdin.nextInt();
if(dong < 1 || dong > MAX)
{
System.out.printf("\nSo dong khong hop le. Xin kiem tra lai!");
}
}while(dong < 1 || dong > MAX);
do
{
System.out.printf("\nNhap vao so cot: ");
cot = stdin.nextInt();
if(cot < 1 || cot > MAX)
{
System.out.printf("\nSo cot khong hop le. Xin kiem tra lai!");
}
}while(cot < 1 || cot > MAX);
for(int i = 0; i < dong; i++)
{
for(int j = 0; j < cot; j++)
{
System.out.printf("\nNhap a[%d][%d] = ", i, j);
a[i][j] = stdin.nextInt();
}
}
}
private void XuatMang() {
for(int i = 0; i < dong; i++)
{
for(int j = 0; j < cot; j++)
{
System.out.printf("%4d", a[i][j]);
}
System.out.printf("\n\n");
}
}
private void ChieuGuongMaTranTheoTrucDoc()
{
for(int i = 0; i < dong; i++)
{
for(int j = cot - 1; j >= 0; j--)
{
System.out.printf("%4d", a[i][j]);
}
System.out.printf("\n\n");
}
}
public static void main(String[] args) {
Main main = new Main();
main.NhapMang();
main.XuatMang();
System.out.printf("\nChieu guong ma tran theo truc doc: \n");
main.ChieuGuongMaTranTheoTrucDoc();
}
}
$\\$
$\\$
$\color{#ffd710}{\texttt{\{}} \color{#8655d6}{\texttt{\{}}\ \ \color{#8cdcda}{\text{Daoanhviet96}}\ \ \color{#8655d6}{\texttt{\}}} \color{#ffd710}{\texttt{\}}}$
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin
1428
25110
482
Ê rồi m biết code mấy ngôn ngữ thế -.-
2901
47812
1863
Cứ ngôn ngữ nào phổ biến thì học thôi :v
1428
25110
482
;-;
5598
4781
3491
Ruby cho t đc k :v Bonus đii