Trang 9 của 9 Đầu tiênĐầu tiên ... 789
Kết quả 81 đến 85 của 85
  1. #81
    Ngày tham gia
    Mar 2015
    Bài viết
    0
    cho mình hỏi tại sao nó lại chạy liên tiêp lệnh"

    Mã nguồn HTML:
    
    
    ;" nhỉ.


    Mã nguồn PHP:
    [color=#000000]
    package cautrucmang[/color][color=#007700]; [/color][color=#ff8000]/**** @author quân* đề:* số lượng sinh viên cần nhập từ bàn phím. khai báo 1 mảng gồm danh sách họ tên sinh viên* tên từng sinh viên nhập từ bàn phím* sau khi nhập xong, chương trình hỏi nhập tên sinh viên muốn tìm kiếm* tìm và in ra kết quả là có trong danh sách hay không.*/[/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]bai1 [/color][color=#007700]{ public static [/color][color=#0000bb]void main[/color][color=#007700]([/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]aprs[/color][color=#007700]){ [/color][color=#0000bb]int so_luong[/color][color=#007700]; [/color][color=#0000bb]string list_sinhvien[/color][color=#007700][]; [/color][color=#0000bb]scanner input [/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].print([/color][color=#dd0000]"số lượng sinh viên "[/color][color=#007700]); [/color][color=#0000bb]so_luong [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); [/color][color=#0000bb]list_sinhvien [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]so_luong[/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]"số lượng sinh viên là " [/color][color=#007700]+[/color][color=#0000bb]so_luong[/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]so_luong[/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]"nhập tên của sinh viên thứ "[/color][color=#007700]+([/color][color=#0000bb]i[/color][color=#007700]+[/color][color=#0000bb]1[/color][color=#007700])); [/color][color=#0000bb]list_sinhvien[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } }}[/color] 

  2. #82
    Ngày tham gia
    Apr 2014
    Bài viết
    0
    mình nộp bài
    bài 1:
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>bai1: (move your mouse to reveal the content)</noscript>

    bai1: (open)
    bai1: (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lession9_bai1[/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]scanner input [/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]0[/color][color=#007700]; [/color][color=#0000bb]string arrstudent[/color][color=#007700][]; [/color][color=#0000bb]string findstu [/color][color=#007700]= [/color][color=#dd0000]""[/color][color=#007700]; [/color][color=#0000bb]lession9_bai1 find_arr [/color][color=#007700]= new [/color][color=#0000bb]lession9_bai1[/color][color=#007700](); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so sinh vien trong mang: "[/color][color=#007700]); [/color][color=#0000bb]n[/color][color=#007700]=[/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]n[/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]"so sinh vien khong duoc <=0. vui long nhap lai"[/color][color=#007700]); }while([/color][color=#0000bb]n[/color][color=#007700]<=[/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]arrstudent [/color][color=#007700]= new [/color][color=#0000bb]string[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]]; [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); [/color][color=#ff8000]//ðoi voi chuoi thi phai khoi tao gia tri dau tien [/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]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap sinh vien 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]arrstudent[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); } [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap ten sinh vien muon tim kiem: "[/color][color=#007700]); [/color][color=#0000bb]findstu [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); if([/color][color=#0000bb]find_arr[/color][color=#007700].[/color][color=#0000bb]findstudent[/color][color=#007700]([/color][color=#0000bb]findstu[/color][color=#007700], [/color][color=#0000bb]arrstudent[/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]"ten sinh vien muon tim khong co trong mang."[/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]"ten sinh vien muon tim la: "[/color][color=#007700]+[/color][color=#0000bb]arrstudent[/color][color=#007700][[/color][color=#0000bb]find_arr[/color][color=#007700].[/color][color=#0000bb]findstudent[/color][color=#007700]([/color][color=#0000bb]findstu[/color][color=#007700], [/color][color=#0000bb]arrstudent[/color][color=#007700])]); } public [/color][color=#0000bb]int findstudent[/color][color=#007700]([/color][color=#0000bb]string sv[/color][color=#007700], [/color][color=#0000bb]string[/color][color=#007700][] [/color][color=#0000bb]arr[/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]++){ if([/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]].[/color][color=#0000bb]equals[/color][color=#007700]([/color][color=#0000bb]sv[/color][color=#007700])) return [/color][color=#0000bb]i[/color][color=#007700]; } return -[/color][color=#0000bb]1[/color][color=#007700]; }}[/color] 
    </blockquote></div>
    </div>
    </div>

    bài 2:
    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>bai2: (move your mouse to reveal the content)</noscript>

    bai2: (open)
    bai2: (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lession9_bai2[/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]scanner input [/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]lession9_bai2 sx [/color][color=#007700]= new [/color][color=#0000bb]lession9_bai2[/color][color=#007700](); [/color][color=#0000bb]int n [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so phan tu day so nguyen: "[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]n [/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]"so phan tu day so nguyen khong duoc phep < 0."[/color][color=#007700]); }while([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]int[/color][color=#007700][] [/color][color=#0000bb]arrayint [/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]n[/color][color=#007700]; [/color][color=#0000bb]i[/color][color=#007700]++){ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao 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]arrayint[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } [/color][color=#0000bb]sx[/color][color=#007700].[/color][color=#0000bb]sapxeptang[/color][color=#007700]([/color][color=#0000bb]arrayint[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700]); } public [/color][color=#0000bb]void sapxeptang[/color][color=#007700]([/color][color=#0000bb]int[/color][color=#007700][] array, [/color][color=#0000bb]int n[/color][color=#007700]){ [/color][color=#0000bb]int temp[/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]n[/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]n[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++){ if(array[[/color][color=#0000bb]i[/color][color=#007700]] > array[[/color][color=#0000bb]j[/color][color=#007700]]){ [/color][color=#0000bb]temp [/color][color=#007700]= array[[/color][color=#0000bb]j[/color][color=#007700]]; array[[/color][color=#0000bb]j[/color][color=#007700]] = array[[/color][color=#0000bb]i[/color][color=#007700]]; array[[/color][color=#0000bb]i[/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]"xuat ra mang so nguyen tang dan: "[/color][color=#007700]); [/color][color=#0000bb]xuatmang[/color][color=#007700](array); } public [/color][color=#0000bb]void xuatmang[/color][color=#007700]([/color][color=#0000bb]int[/color][color=#007700][] array){ for([/color][color=#0000bb]int i [/color][color=#007700]= [/color][color=#0000bb]0[/color][color=#007700]; [/color][color=#0000bb]i [/color][color=#007700]< array.[/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].print(array[[/color][color=#0000bb]i[/color][color=#007700]] + [/color][color=#dd0000]" "[/color][color=#007700]); }}[/color] 
    </blockquote></div>
    </div>
    </div>

    bài 3:

    <div class="bbcodeblock bbcodequote bbcmspoilerblock">
    <div class="attribution type"><noscript>bai3: (move your mouse to reveal the content)</noscript>

    bai3: (open)
    bai3: (close)

    </div>
    <div class="quotecontent">
    <div class="bbcm_spoiler_noscript"><blockquote>


    Mã nguồn PHP:
    [color=#000000]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner[/color][color=#007700]; public class [/color][color=#0000bb]lession9_bai3[/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]scanner input [/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 m[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700]; [/color][color=#0000bb]int[/color][color=#007700][][] [/color][color=#0000bb]array1[/color][color=#007700], [/color][color=#0000bb]array2[/color][color=#007700], [/color][color=#0000bb]arraytong[/color][color=#007700]; [/color][color=#0000bb]lession9_bai3 bai [/color][color=#007700]= new [/color][color=#0000bb]lession9_bai3[/color][color=#007700](); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so hang trong mang: "[/color][color=#007700]); [/color][color=#0000bb]m [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]m [/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]"so hang trong mang khong <0."[/color][color=#007700]); }while([/color][color=#0000bb]m[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap vao so cot trong mang: "[/color][color=#007700]); [/color][color=#0000bb]n [/color][color=#007700]= [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]n[/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]"so cot trong mang khong < 0"[/color][color=#007700]); }while([/color][color=#0000bb]n[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]); [/color][color=#0000bb]array1 [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]][[/color][color=#0000bb]m[/color][color=#007700]]; [/color][color=#0000bb]array2 [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]][[/color][color=#0000bb]m[/color][color=#007700]]; [/color][color=#0000bb]arraytong [/color][color=#007700]= new [/color][color=#0000bb]int[/color][color=#007700][[/color][color=#0000bb]n[/color][color=#007700]][[/color][color=#0000bb]m[/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 mang thu 1: "[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]nhapmang[/color][color=#007700]([/color][color=#0000bb]array1[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/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 mang thu 2: "[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]nhapmang[/color][color=#007700]([/color][color=#0000bb]array2[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]tinhtong[/color][color=#007700]([/color][color=#0000bb]array1[/color][color=#007700], [/color][color=#0000bb]array2[/color][color=#007700], [/color][color=#0000bb]arraytong[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/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]"tong 2 ma tran duoc: "[/color][color=#007700]); [/color][color=#0000bb]bai[/color][color=#007700].[/color][color=#0000bb]xuatmang[/color][color=#007700]([/color][color=#0000bb]arraytong[/color][color=#007700], [/color][color=#0000bb]n[/color][color=#007700], [/color][color=#0000bb]m[/color][color=#007700]); } public [/color][color=#0000bb]void nhapmang[/color][color=#007700]([/color][color=#0000bb]int [/color][color=#007700]array[][], [/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]int m[/color][color=#007700]){ [/color][color=#0000bb]scanner input [/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]); 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]n[/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]m[/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=#dd0000]"phan tu ["[/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]); array[[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]input[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); } } public [/color][color=#0000bb]void xuatmang[/color][color=#007700]([/color][color=#0000bb]int [/color][color=#007700]array[][], [/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]int m[/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]n[/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]m[/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(array[[/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].print([/color][color=#dd0000]"
    "[/color][color=#007700]); } } public [/color][color=#0000bb]void tinhtong[/color][color=#007700]([/color][color=#0000bb]int array1[/color][color=#007700][][], [/color][color=#0000bb]int array2[/color][color=#007700][][], [/color][color=#0000bb]int tong[/color][color=#007700][][], [/color][color=#0000bb]int n[/color][color=#007700], [/color][color=#0000bb]int m[/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]n[/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]m[/color][color=#007700]; [/color][color=#0000bb]j[/color][color=#007700]++) [/color][color=#0000bb]tong[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] = [/color][color=#0000bb]array1[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]] + [/color][color=#0000bb]array2[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]][[/color][color=#0000bb]j[/color][color=#007700]]; }}[/color] 
    </blockquote></div>
    </div>
    </div>

    thanks.

  3. #83
    Ngày tham gia
    Jun 2014
    Bài viết
    0
    mình bị cái lỗi như thế này thằng đầu tiên k nhập được từ bàn phím tự bị cho là 1 dấu space là sao thế @@ bác nào giúp mình sửa lỗi với

  4. #84
    Ngày tham gia
    May 2014
    Bài viết
    0
    Trích dẫn Gửi bởi manhtuan1031990

    Mã:
    public class newclass1 {
    	public static void main(string[] args) {
    		int [] array = {9, 8, 7, 6, 5, 4};
    		int n = 6, i, j, temp ;
    		for(i = 0; i<n-1 ; i++)
    		{
    			for(j= i-1; j<n; j++)
    			{
    				if(array[j] < array[i])
    				{
    				temp = array[i];
    				array[i] = array[j];
    				temp = array[j];
    				}
    			}
    		}
    		for(i=0; i<n; i++)
    		{
    			system.out.print(array[i]+ " ");
    		}
    	}
    }
     
    cac bac giup em voi, sap xep theo thu tu tang dan
    code tăng dần nè bạn:
    for(int i=0;i<nhap;i++){
    for(int j=i+1;j<nhap;j++){
    if (a>a[j]){
    rong=a[j];
    a[j]=a;
    a=rong;
    }
    }

  5. #85
    Ngày tham gia
    May 2014
    Bài viết
    0
    Mã nguồn PHP:
    [color=#000000]
    package javacoban[/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]arr2 [/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]scanner inp [/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]i[/color][color=#007700],[/color][color=#0000bb]g[/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 phan tu cua mang"[/color][color=#007700]);[/color][color=#0000bb]n[/color][color=#007700]=[/color][color=#0000bb]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();[/color][color=#0000bb]int arr[/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]i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]n[/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]"nhap phan tu thu "[/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]inp[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700]();}for ([/color][color=#0000bb]i[/color][color=#007700]=[/color][color=#0000bb]n[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]>[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/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]i[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700]] ){ [/color][color=#0000bb]g[/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]i[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700]];[/color][color=#0000bb]arr[/color][color=#007700][[/color][color=#0000bb]i[/color][color=#007700]-[/color][color=#0000bb]1[/color][color=#007700]]=[/color][color=#0000bb]g[/color][color=#007700];}}for ([/color][color=#0000bb]i[/color][color=#007700]=[/color][color=#0000bb]0[/color][color=#007700];[/color][color=#0000bb]i[/color][color=#007700]<[/color][color=#0000bb]n[/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]]);}}[[/color][color=#0000bb]spoiler[/color][color=#007700]=[/color][color=#0000bb]bai 1[/color][color=#007700]][/[/color][color=#0000bb]spoiler[/color][color=#007700]] } } }[/color] 

Trang 9 của 9 Đầu tiênĐầu tiên ... 789

Quyền viết bài

  • Bạn Không thể gửi Chủ đề mới
  • Bạn Không thể Gửi trả lời
  • Bạn Không thể Gửi file đính kèm
  • Bạn Không thể Sửa bài viết của mình
  •