Chủ đề: Bài 9: Mảng trong Java!
-
09-04-2013, 07:00 AM #31Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
Gửi bởi vantuancnc
for(i=0;i<0;i++){
for(int j=0;j<=i;j++)
-
09-04-2013, 07:00 AM #32Banned
- Ngày tham gia
- Jan 2015
- Bài viết
- 0
Gửi bởi heroofyouy2k
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
</blockquote></div>
</div>
</div>
Mã nguồn PHP:[color=#000000]
lúc bạn nhập số lượng sinh viên[/color][color=#007700]. [/color][color=#0000bb]tức là n[/color][color=#007700]=[/color][color=#0000bb]4 chẳng hạn[/color][color=#007700].[/color][color=#0000bb]lúc này ở dử liệu bạn vừa nhập n[/color][color=#007700]=[/color][color=#0000bb]4 và nó còn thừa 1 kýtự [/color][color=#dd0000]"enter" [/color][color=#0000bb]xuống dòng[/color][color=#007700]. [/color][color=#0000bb]cho nên khi chạy sang câu lệnhtiếp theo[/color][color=#007700]. [/color][color=#0000bb]khi bạn muốn nhật tên sinh viên thứ nhất[/color][color=#007700], [/color][color=#0000bb]thìneatbeans hoặc eclipse của bạn sẽ ngầm định gán kí tự[/color][color=#dd0000]"enter" [/color][color=#0000bb]này cho dử liệu mà bạn nhập vào[/color][color=#007700]. [/color][color=#0000bb]cho nên bạn chỉnhập được những data sau mà không hề bị gì[/color][color=#007700]... [/color][color=#0000bb]để giải quyết vấn đề[/color][color=#007700]: [/color][color=#0000bb]bạn phải loại bỏ ký tự xuống dòng đó[/color][color=#007700].[/color][color=#0000bb]vd[/color][color=#007700]: [/color][color=#0000bb]ban đầu khai báo[/color][color=#007700]: [/color][color=#0000bb]scanner in [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#ff8000]// khi bạn nhập số lượng sinh viên xong. [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); [/color][color=#ff8000]// khi nhập vào thì ide chỉ nhận n=4 chẳng hạn, [/color][color=#0000bb]in[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#ff8000]// loại bỏ kí tự enter. // sau đó nhập bình thường.[/color]
-
09-05-2013, 07:00 AM #33Junior Member
- Ngày tham gia
- Sep 2014
- Bài viết
- 9
Mã:import java.util.scanner; public class bai1 { /** * @param args the command line arguments */ public static void main(string[] args) { scanner in = new scanner(system.in); int n; string t,tsv; system.out.println("so sinh vien can nhap la: "); n = in.nextint(); in.nextline(); string [] sosv = new string[n]; for (int i = 0; i < sosv.length; i++){ system.out.println("ten sv thu " + (i+1) + " la: "); sosv[i] = in.nextline(); } system.out.println("ten sv can tim la: "); tsv =in.nextline(); for ( int i = 0; i < n; i++){ if (tsv.equals(sosv[i])){ system.out.println("co sinh vien trong danh sach"); break; } else { system.out.println("khong co sinh vien trong danh sach"); break; } } } }
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote></blockquote></div>
</div>
</div>
Mã:import java.util.scanner; public class bai2 { /** * @param args the command line arguments */ public static void main(string[] args) { // todo code application logic here scanner in = new scanner(system.in); int n,tg,i; system.out.println("tong so can nhap la: "); n = in.nextint(); int [] nhaplieu = new int[n]; for ( i = 0; i< n; i++){ system.out.println("so thu " + (i+1) + " la: "); nhaplieu[i] = in.nextint(); } system.out.println("sep lai mang theo chieu tang dan: "); for ( i = 0; i< n; i++){ for (int j = i+1; j< n; j++){ if (nhaplieu[i]>nhaplieu[j]){ tg = nhaplieu[i]; nhaplieu[i] = nhaplieu[j]; nhaplieu[j] = tg; } } system.out.println("so thu " + (i+1) + " la: "); system.out.println(nhaplieu[i]); } } }
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote></blockquote></div>
</div>
</div>
Mã:import java.util.scanner; public class bai3 { /** * @param args the command line arguments */ public static void main(string[] args) { // todo code application logic here scanner in = new scanner(system.in); int h,c; system.out.println("nhap so hang: "); h = in.nextint(); system.out.println("nhap so cot: "); c = in.nextint(); int [] [] mt1 = new int[h][c]; system.out.println("nhap ma tran 1: "); for ( int i =0; i <h ; i++){ for (int j = 0; j <c;j++){ system.out.println("a["+i+"]["+j+"]"); mt1[i][j] = in.nextint(); } } system.out.println("ma tran 1 vua nhap la: "); for ( int i =0; i <h ; i++){ for (int j = 0; j <c;j++){ system.out.println(" " + mt1[i][j]); } system.out.println(""); } int [] [] mt2 = new int[h][c]; system.out.println("nhap ma tran 2: "); for ( int i =0; i <h ; i++){ for (int j = 0; j <c;j++){ system.out.println("a["+i+"]["+j+"]"); mt2[i][j] = in.nextint(); } } system.out.println("ma tran 2 vua nhap la: "); for ( int i =0; i <h ; i++){ for (int j = 0; j <c;j++){ system.out.println(" " + mt2[i][j]); } system.out.println(""); } system.out.println("cong 2 ma tran: "); int [][] mt3 = new int[h][c]; for (int i =0; i <h; i++){ for (int j =0; j< c; j++){ mt3[i][j] = mt1[i][j] + mt2[i][j]; system.out.println(" "+ mt3[i][j]); } system.out.println(""); } } }
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote></blockquote></div>
</div>
</div>
-
09-08-2013, 07:00 AM #34Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
bai 01
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.util.scanner; public class bai02 { public static void main(string[]args) throws numberformatexception, ioexception{ int n; string[]s=new string[10]; bufferedreader ii=new bufferedreader(new inputstreamreader(system.in)); scanner in=new scanner(system.in); system.out.println("nhap so sv: "); n=integer.parseint(ii.readline()); system.out.println("nhap ho ten sv:"); int i,j; for(i=0;i<n;i++) { system.out.print("sv "+i+": "); s[i]=in.nextline(); } system.out.println("danh sach sv da nhap:"); for(i=0;i<n;i++) { system.out.println(s[i]); } system.out.println("nhap ho ten sv can kiem tra:"); string s1=new string(); s1=in.nextline(); int dem=0; for(i=0;i<n;i++) { if(s[i].equals(s1)) { system.out.println("co sv nay trong ds"); dem++; break; } } if(dem<1) { system.out.println("khong co sv nay trong ds"); } } }
</div>
</div>
-
09-08-2013, 07:00 AM #35Junior Member
- Ngày tham gia
- Oct 2014
- Bài viết
- 0
bai 02
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:import java.util.scanner; public class bai02 { public static void main(string[]args){ scanner in=new scanner(system.in); int n; system.out.println("so n can nhap: "); n=in.nextint(); int i; int[]a=new int[n]; system.out.println("nhap phan tu mang:"); for(i=0;i<n;i++) { system.out.println("so thu "+i+":"); a[i]=in.nextint(); } system.out.println("mang da nhap la:"); for(i=0;i<n;i++) { system.out.print(a[i]+"\t"); } system.out.println(" (sap xep mang)"); int j,tmp; for(i=0;i<n-1;i++) { for(j=i+1;j<n;j++) { if(a[i]>a[j]) { tmp=a[i]; a[i]=a[j]; a[j]=tmp; } } } system.out.println("mang sau khi duoc sap xep:"); for(i=0;i<n;i++) { system.out.print(a[i]+"\t"); } } }
</div>
</div>
-
09-08-2013, 07:00 AM #36Junior Member
- Ngày tham gia
- Apr 2014
- Bài viết
- 0
bai 03
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã:import java.util.scanner; public class bai02 { public static void main(string[]args){ scanner in=new scanner(system.in); int n,m; system.out.println("cap ma tran can nhap: "); n=in.nextint(); m=in.nextint(); system.out.println("nhap phan tu ma tran :"); int[][]a=new int[n][m]; int[][]b=new int[n][m]; int[][]c=new int[n][m]; system.out.println("nhap ma tran thu 1: "); nhapmt(a,n,m); system.out.println("nhap ma tran thu 2: "); nhapmt(b,n,m); system.out.println("in ma tran thu 1:"); inmt(a,n,m); system.out.println("in ma tran thu 2: "); inmt(b,n,m); system.out.println("tong 2 ma tran "); tongmt(a,b,c,n,m); } public static void nhapmt(int [][]a,int n,int m) { scanner in=new scanner(system.in); for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { system.out.print(i+","+j+": "); a[i][j]=in.nextint(); } } } public static void inmt(int [][]a,int n,int m) { for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { system.out.print(a[i][j]+"\t"); } system.out.println(); } } public static void tongmt(int [][]a,int[][]b,int[][]c,int n,int m) { for(int i=0;i<n;i++) { for(int j=0;j<m;j++) { c[i][j]=a[i][j]+b[i][j]; system.out.print(c[i][j]+"\t"); } system.out.println(); } } }
</div>
</div>
-
09-17-2013, 07:00 AM #37Junior Member
- Ngày tham gia
- Dec 2014
- Bài viết
- 0
Gửi bởi hohoaikiet
-
09-17-2013, 07:00 AM #38Junior Member
- Ngày tham gia
- May 2014
- Bài viết
- 0
Gửi bởi somedayiws
-
10-10-2013, 07:00 AM #39Junior Member
- Ngày tham gia
- Mar 2015
- Bài viết
- 0
sao không bạn nào post bài lên để cùng nhau thảo luận nếu ai chưa làm được thì có thể hỏi nhau được nhiều hơn mình mới vào website này nên mong các bạn giúp đỡ nhiều
-
10-18-2013, 07:00 AM #40Junior Member
- Ngày tham gia
- Feb 2015
- Bài viết
- 0
bai cua minh ne, mong cac ban dong gop y kien :d
<div class="bbcodeblock bbcodequote bbcmspoilerblock">
<div class="attribution type"><noscript>spoiler (move your mouse to the spoiler area to reveal the content)</noscript>
show spoiler
hide spoiler
</div>
<div class="quotecontent">
<div class="bbcm_spoiler_noscript"><blockquote>
Mã nguồn PHP:[color=#000000]
package com[/color][color=#007700].[/color][color=#0000bb]hanhnv[/color][color=#007700].[/color][color=#0000bb]core[/color][color=#007700]; [/color][color=#0000bb]import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]bai9 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]args[/color][color=#007700]) { [/color][color=#0000bb]bai1[/color][color=#007700](); [/color][color=#0000bb]bai2[/color][color=#007700](); [/color][color=#0000bb]bai3[/color][color=#007700](); } public static [/color][color=#0000bb]void bai1[/color][color=#007700]() { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so sinh vien: "[/color][color=#007700]); [/color][color=#0000bb]scanner s [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]1[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"ban phai nhap so sinh vien lon hon 0, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } [/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]arrsv [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; [/color][color=#0000bb]boolean found [/color][color=#007700]= [/color][color=#0000bb]false[/color][color=#007700]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]arrsv[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien thu " [/color][color=#007700]+ ([/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]) + [/color][color=#dd0000]" la: "[/color][color=#007700]); [/color][color=#0000bb]arrsv[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap ten sinh vien can tim: "[/color][color=#007700]); [/color][color=#0000bb]string search [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]arrsv[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { if ([/color][color=#0000bb]search[/color][color=#007700].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#0000bb]arrsv[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]])) { [/color][color=#0000bb]j[/color][color=#007700]++; } } if ([/color][color=#0000bb]j [/color][color=#007700]== [/color][color=#0000bb]0[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"khong co sinh vien nao ten " [/color][color=#007700]+ [/color][color=#0000bb]search [/color][color=#007700]+ [/color][color=#dd0000]" o trong danh sach."[/color][color=#007700]); } else [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"sinh vien ten " [/color][color=#007700]+ [/color][color=#0000bb]search [/color][color=#007700]+ [/color][color=#dd0000]" co trong danh sach nay."[/color][color=#007700]); } public static [/color][color=#0000bb]void bai2[/color][color=#007700](){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap vao so phan tu: "[/color][color=#007700]); [/color][color=#0000bb]scanner s [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]2[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap it nhat la 2 phan tu, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } [/color][color=#0000bb]int[/color][color=#007700][] [/color][color=#0000bb]arr [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]arr[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"phan tu thu "[/color][color=#007700]+([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700])+[/color][color=#dd0000]": "[/color][color=#007700]); [/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]arr[/color][color=#007700].[/color][color=#0000bb]length [/color][color=#007700]- [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]i [/color][color=#007700]+ [/color][color=#0000bb]1[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]arr[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { if ([/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]>[/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]) { [/color][color=#0000bb]int temp [/color][color=#007700]= [/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]; [/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]]; [/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]temp[/color][color=#007700]; } } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"cac phan tu sau khi nhap la: "[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]arr[/color][color=#007700].[/color][color=#0000bb]length[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]]); } } public static [/color][color=#0000bb]void bai3[/color][color=#007700](){ [/color][color=#0000bb]scanner s [/color][color=#007700]= new [/color][color=#0000bb]scanner[/color][color=#007700]([/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]in[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so cot: "[/color][color=#007700]); [/color][color=#0000bb]int columns [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]columns[/color][color=#007700]<[/color][color=#0000bb]2[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap it nhat la 2 phan tu, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]columns[/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap so dong: "[/color][color=#007700]); [/color][color=#0000bb]int rows [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); while ([/color][color=#0000bb]rows[/color][color=#007700]<[/color][color=#0000bb]2[/color][color=#007700]) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"nhap it nhat la 2 phan tu, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]rows [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } [/color][color=#0000bb]int[/color][color=#007700][][] [/color][color=#0000bb]arr1 [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]rows[/color][color=#007700]][[/color][color=#0000bb]columns[/color][color=#007700]]; [/color][color=#0000bb]int[/color][color=#007700][][] [/color][color=#0000bb]arr2 [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]rows[/color][color=#007700]][[/color][color=#0000bb]columns[/color][color=#007700]]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"bat dau nhap ma tran 1:"[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]rows[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]columns[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"phan tu ma tran 1 arr["[/color][color=#007700]+[/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#dd0000]"]["[/color][color=#007700]+[/color][color=#0000bb]j[/color][color=#007700]+[/color][color=#dd0000]"]"[/color][color=#007700]); [/color][color=#0000bb]arr1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"bat dau nhap ma tran 2:"[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]rows[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]columns[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]"phan tu ma tran 2 arr["[/color][color=#007700]+[/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#dd0000]"]["[/color][color=#007700]+[/color][color=#0000bb]j[/color][color=#007700]+[/color][color=#dd0000]"]"[/color][color=#007700]); [/color][color=#0000bb]arr2[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"ma tran 1: "[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]rows[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]columns[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]arr1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]]+[/color][color=#dd0000]" "[/color][color=#007700]); } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"ma tran 2: "[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]rows[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]columns[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#0000bb]arr2[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]]+[/color][color=#dd0000]" "[/color][color=#007700]); } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"tong 2 ma tran: "[/color][color=#007700]); for ([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< [/color][color=#0000bb]rows[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]" "[/color][color=#007700]); for ([/color][color=#0000bb]int j [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]j [/color][color=#007700]< [/color][color=#0000bb]columns[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print(([/color][color=#0000bb]arr1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] + [/color][color=#0000bb]arr2[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]])+[/color][color=#dd0000]" "[/color][color=#007700]); } } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].[/color][color=#0000bb]println[/color][color=#007700]([/color][color=#dd0000]""[/color][color=#007700]); } } [/color]
</div>
</div>
Khu dự án Diamond Alnata Plus phát triển bởi Gamuda Land thiết kế hợp lý nằm trung tâm thông gió tự nhiên. Diamond Alnata Plus Tân Phú thiết kế hợp lý sống đích thực ngay giữa trung tâm. Căn hộ cách...
Khu dự án Diamond Alnata Plus giáp trung tâm