Trang 7 của 13 Đầu tiênĐầu tiên ... 56789 ... CuốiCuối
Kết quả 61 đến 70 của 124
  1. #61
    Ngày tham gia
    Apr 2015
    Bài viết
    0
    <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]
    import java[/color][color=#007700].[/color][color=#0000bb]util[/color][color=#007700].[/color][color=#0000bb]scanner [/color][color=#007700];public class [/color][color=#0000bb]diemtrungbinh [/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]string ten[/color][color=#007700]; [/color][color=#0000bb]int tuoi[/color][color=#007700]; [/color][color=#0000bb]float toan[/color][color=#007700],[/color][color=#0000bb]ly[/color][color=#007700],[/color][color=#0000bb]hoa[/color][color=#007700],[/color][color=#0000bb]tbc[/color][color=#007700]; [/color][color=#0000bb]scanner nhapdulieu [/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]"nhap ho va ten : "[/color][color=#007700]); [/color][color=#0000bb]ten[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextline[/color][color=#007700](); do { [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap tuoi : "[/color][color=#007700]); [/color][color=#0000bb]tuoi[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if([/color][color=#0000bb]tuoi[/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]"nhap sai nhap lai"[/color][color=#007700]);} while ([/color][color=#0000bb]tuoi[/color][color=#007700]<[/color][color=#0000bb]1[/color][color=#007700]); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem mon toan: "[/color][color=#007700]); [/color][color=#0000bb]toan[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if([/color][color=#0000bb]toan[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]||[/color][color=#0000bb]toan[/color][color=#007700]>[/color][color=#0000bb]10[/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 sai nhap lai"[/color][color=#007700]);} while([/color][color=#0000bb]toan[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]||[/color][color=#0000bb]toan[/color][color=#007700]>[/color][color=#0000bb]10[/color][color=#007700]); do{ [/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 diem mon ly "[/color][color=#007700]); [/color][color=#0000bb]ly[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if([/color][color=#0000bb]ly[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]||[/color][color=#0000bb]ly[/color][color=#007700]>[/color][color=#0000bb]10[/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 sai nhap lai"[/color][color=#007700]);} while([/color][color=#0000bb]ly[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]||[/color][color=#0000bb]ly[/color][color=#007700]>[/color][color=#0000bb]10[/color][color=#007700]); do{ [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"nhap diem mon hoa: "[/color][color=#007700]); [/color][color=#0000bb]hoa[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if([/color][color=#0000bb]hoa[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]||[/color][color=#0000bb]hoa[/color][color=#007700]>[/color][color=#0000bb]10[/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 sai nhap lai "[/color][color=#007700]);} while([/color][color=#0000bb]hoa[/color][color=#007700]<[/color][color=#0000bb]0[/color][color=#007700]||[/color][color=#0000bb]hoa[/color][color=#007700]>[/color][color=#0000bb]10[/color][color=#007700]); [/color][color=#0000bb]tbc[/color][color=#007700]=([/color][color=#0000bb]toan[/color][color=#007700]+[/color][color=#0000bb]ly[/color][color=#007700]+[/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"diem trung binh : "[/color][color=#007700]+[/color][color=#0000bb]tbc[/color][color=#007700]+[/color][color=#dd0000]"
    "[/color][color=#007700]); if([/color][color=#0000bb]tbc[/color][color=#007700]>[/color][color=#0000bb]8[/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]"xep loai gioi"[/color][color=#007700]); else if([/color][color=#0000bb]tbc[/color][color=#007700]>[/color][color=#0000bb]6.5[/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]"xep loai kha"[/color][color=#007700]); else if([/color][color=#0000bb]tbc[/color][color=#007700]>[/color][color=#0000bb]5[/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]"xep loai trung binh"[/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]"xep loai yeu"[/color][color=#007700]); }}[/color] 
    </blockquote></div>
    </div>
    </div>

  2. #62
    Ngày tham gia
    Mar 2015
    Bài viết
    0
    cho mình hỏi sao mình bị lỗi này tks(lỗi chữ màu đỏ mình đánh dấu oy đó)

    package bt1;

    import java.util.scanner;

    /**
    *
    * @author nguye_000
    */
    public class studentmanager {
    string hoten;
    string namsinh;
    float toan;
    float ly;
    float hoa;
    float dtb;
    public void nhap(){

    scanner sc = new scanner(system.in);
    system.out.println("mời nhập vào tên sinh viên: ");
    hoten = sc.nextline();
    system.out.println("mời nhập vào năm sinh: ");
    namsinh = sc.nextline();
    system.out.println("nhập vào điểm toán: ");
    toan = sc.nextfloat();
    system.out.println("nhập vào điểm ly: ");
    ly = sc.nextfloat();
    system.out.println("nhập vào điểm toán: ");
    hoa = sc.nextfloat();
    dtb=(toan+ly+hoa)/3;
    system.out.println("họ tên: " +hoten);
    system.out.println("năm sinh: " +namsinh);
    system.out.println("điểm tb: " +dtb);
    }
    run:
    mời nhập vào tên sinh viên:
    anh tuan
    mời nhập vào năm sinh:
    1993
    nhập vào điểm toán:
    8.9
    nhập vào điểm ly:
    9.2
    nhập vào điểm toán:
    8.3
    họ tên: anh tuan
    năm sinh: 1993
    điểm tb: 8.799999
    java result: -1073741819
    build successful (total time: 24 seconds)

  3. #63
    Ngày tham gia
    May 2014
    Bài viết
    0
    bài của mình nè:
    <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]bai7 [/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]string fullname[/color][color=#007700]; [/color][color=#0000bb]int namsinh[/color][color=#007700]; [/color][color=#0000bb]float diemtoan[/color][color=#007700], [/color][color=#0000bb]diemly[/color][color=#007700], [/color][color=#0000bb]diemhoa[/color][color=#007700], [/color][color=#0000bb]diemtb[/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 ho va ten: "[/color][color=#007700]); [/color][color=#0000bb]fullname [/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 nam sinh: "[/color][color=#007700]); [/color][color=#0000bb]namsinh [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextint[/color][color=#007700](); if ([/color][color=#0000bb]namsinh [/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]"ban da nhap nam sinh khong hop le, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]diemtoan [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/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 diem toan: "[/color][color=#007700]); [/color][color=#0000bb]diemtoan [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if ([/color][color=#0000bb]diemtoan [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]diemtoan [/color][color=#007700]> [/color][color=#0000bb]10[/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 da nhap diem toan khong hop le, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]diemtoan [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/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 diem ly: "[/color][color=#007700]); [/color][color=#0000bb]diemly [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if ([/color][color=#0000bb]diemly [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]diemly [/color][color=#007700]> [/color][color=#0000bb]10[/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 da nhap diem ly khong hop le, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]diemly [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/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 diem hoa: "[/color][color=#007700]); [/color][color=#0000bb]diemhoa [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); if ([/color][color=#0000bb]diemhoa [/color][color=#007700]< [/color][color=#0000bb]0 [/color][color=#007700]|| [/color][color=#0000bb]diemhoa [/color][color=#007700]> [/color][color=#0000bb]10[/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 da nhap diem hoa khong hop le, vui long nhap lai: "[/color][color=#007700]); [/color][color=#0000bb]diemhoa [/color][color=#007700]= [/color][color=#0000bb]s[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); } [/color][color=#0000bb]diemtb [/color][color=#007700]= (float) ([/color][color=#0000bb]diemtoan [/color][color=#007700]+ [/color][color=#0000bb]diemly [/color][color=#007700]+ [/color][color=#0000bb]diemhoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700]; if ([/color][color=#0000bb]diemtb[/color][color=#007700]>=[/color][color=#0000bb]8.0 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]<=[/color][color=#0000bb]10.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]"diem trung binh cua "[/color][color=#007700]+ [/color][color=#0000bb]fullname [/color][color=#007700]+ [/color][color=#dd0000]" la "[/color][color=#007700]+[/color][color=#0000bb]diemtb[/color][color=#007700]+[/color][color=#dd0000]", ban la hoc sinh gioi day :d."[/color][color=#007700]); } else if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]6.5 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]< [/color][color=#0000bb]8.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]"diem trung binh cua "[/color][color=#007700]+ [/color][color=#0000bb]fullname [/color][color=#007700]+ [/color][color=#dd0000]" la "[/color][color=#007700]+[/color][color=#0000bb]diemtb[/color][color=#007700]+[/color][color=#dd0000]", ban la hoc sinh kha nhe!."[/color][color=#007700]); } else if ([/color][color=#0000bb]diemtb [/color][color=#007700]>= [/color][color=#0000bb]5.0 [/color][color=#007700]&& [/color][color=#0000bb]diemtb [/color][color=#007700]<[/color][color=#0000bb]6.5[/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]"diem trung binh cua "[/color][color=#007700]+ [/color][color=#0000bb]fullname [/color][color=#007700]+ [/color][color=#dd0000]" la "[/color][color=#007700]+[/color][color=#0000bb]diemtb[/color][color=#007700]+[/color][color=#dd0000]", ban chi la hoc sinh trung binh thoi."[/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]"diem trung binh cua "[/color][color=#007700]+ [/color][color=#0000bb]fullname [/color][color=#007700]+ [/color][color=#dd0000]" la "[/color][color=#007700]+[/color][color=#0000bb]diemtb[/color][color=#007700]+[/color][color=#dd0000]", ban hoc yeu kem qua!. "[/color][color=#007700]+[/color][color=#0000bb]fullname[/color][color=#007700]+ [/color][color=#dd0000]", ban can phai co gang hon!"[/color][color=#007700]); }}[/color] 
    </blockquote></div>
    </div>
    </div>

  4. #64
    Ngày tham gia
    Feb 2015
    Bài viết
    48
    ad mid cho minh hoi cai nay nha
    co su khac nhau giua hai lenh nay ban giai thich dum minh nha:
    code1:
    system.out.print("nhập tên: ");
    ten = nhapdulieu.nextline();
    system.out.print("nhập tuổi: ");
    tuoi = nhapdulieu.nextint();
    code2:
    system.out.print("nhập tuổi: ");
    tuoi = nhapdulieu.nextint();
    sssystem.out.print("nhập tên: ");
    ten = nhapdulieu.nextline();

  5. #65
    Ngày tham gia
    Apr 2015
    Bài viết
    0
    nộp bài nè ^^
    <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 bt1 {
        public static void main(string[] args) {
            scanner input = new scanner(system.in);
            system.out.println("nhap vao ho va ten:");
            string ten = input.nextline();
            float diemtoan, diemly, diemhoa;
            system.out.println("nhap diem toan:");
            diemtoan = input.nextfloat();
            system.out.println("nhap diem ly:");
            diemly = input.nextfloat();
            system.out.println("nhap diem hoa:");
            diemhoa = input.nextfloat();
            float diemtb = (diemtoan + diemly + diemhoa)/3;
            system.out.println(ten);
            system.out.println("diem trung binh 3 mon: " + diemtb);
            if (diemtb >= 8) {
                system.out.println("hoc sinh gioi.");
            } else if (diemtb < 8 && diemtb >= 6.5) {
                system.out.println("hoc sinh kha.");
            } else {
                system.out.println("hoc sinh trung binh.");
            }
        }
    }
    </blockquote></div>
    </div>
    </div>

  6. #66
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    bài 1:
    <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 unit7[/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]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]string hoten[/color][color=#007700]; [/color][color=#0000bb]int namsinh[/color][color=#007700]; [/color][color=#0000bb]float toan[/color][color=#007700],[/color][color=#0000bb]ly[/color][color=#007700],[/color][color=#0000bb]hoa[/color][color=#007700],[/color][color=#0000bb]tb[/color][color=#007700]; [/color][color=#0000bb]scanner nhapdulieu[/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]"
    nhập họ tên:"[/color][color=#007700]);[/color][color=#0000bb]hoten[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/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]"
    nhập năm sinh"[/color][color=#007700]);[/color][color=#0000bb]namsinh[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/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]"
    điểm toán:"[/color][color=#007700]);[/color][color=#0000bb]toan[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    điểm lý:"[/color][color=#007700]);[/color][color=#0000bb]ly[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"
    điểm hóa:"[/color][color=#007700]);[/color][color=#0000bb]hoa[/color][color=#007700]=[/color][color=#0000bb]nhapdulieu[/color][color=#007700].[/color][color=#0000bb]nextfloat[/color][color=#007700](); [/color][color=#0000bb]tb[/color][color=#007700]=(float)([/color][color=#0000bb]toan[/color][color=#007700]+[/color][color=#0000bb]ly[/color][color=#007700]+[/color][color=#0000bb]hoa[/color][color=#007700])/[/color][color=#0000bb]3[/color][color=#007700]; [/color][color=#0000bb]system[/color][color=#007700].[/color][color=#0000bb]out[/color][color=#007700].print([/color][color=#dd0000]"sinh viên: "[/color][color=#007700]+[/color][color=#0000bb]hoten[/color][color=#007700]+[/color][color=#dd0000]"\tnăm sinh:"[/color][color=#007700]+[/color][color=#0000bb]namsinh[/color][color=#007700]+[/color][color=#dd0000]"\tđiểm trung bình:"[/color][color=#007700]+[/color][color=#0000bb]tb[/color][color=#007700]+[/color][color=#dd0000]"
    "[/color][color=#007700]); if([/color][color=#0000bb]tb[/color][color=#007700]>=[/color][color=#0000bb]8[/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]"
    xếp loại giỏi"[/color][color=#007700]); } else{ if([/color][color=#0000bb]tb[/color][color=#007700]>=[/color][color=#0000bb]7[/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]"
    xếp loại khá"[/color][color=#007700]); } else{ if([/color][color=#0000bb]tb[/color][color=#007700]>=[/color][color=#0000bb]5[/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]"
    xếp loại trung bình"[/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]"\
    xếp loại yếu "[/color][color=#007700]); } } } }}[/color] 
    </blockquote></div>
    </div>
    </div>

  7. #67
    Ngày tham gia
    Jul 2014
    Bài viết
    9
    Trích dẫn Gửi bởi quangbk105
    ad mid cho minh hoi cai nay nha
    co su khac nhau giua hai lenh nay ban giai thich dum minh nha:
    code1:
    system.out.print("nhập tên: ");
    ten = nhapdulieu.nextline();
    system.out.print("nhập tuổi: ");
    tuoi = nhapdulieu.nextint();
    code2:



    Mã:
    theo mình nghĩ là do bộ đệm bàn phím. code1 thì ok, code2 có thể sửa thành:
    system.out.print("nhập tuổi: ");
     
    tuoi = nhapdulieu.nextint();
    nhapdulieu.nextline();
    //hoặc khai báo nhapdulieu=new scanner(system.in);
     
    system.out.print("nhập tên: ");
     
    ten = nhapdulieu.nextline();

  8. #68
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    /*
    * to change this template, choose tools | templates
    * and open the template in the editor.
    */
    package android.vn;

    import java.util.scanner;

    /**
    *
    * @author nguyen quoc hien
    */
    public class demo_1 {

    public static void main(string[] args) {
    student st = new student();
    st.nhap();

    }
    }

    class student {

    private string hoten;
    private int namsinh;
    private float toan, ly, hoa;

    public void nhap() {
    scanner sc = new scanner(system.in);
    system.out.print("nhap ho ten vao : ");
    hoten = sc.nextline();

    do {
    system.out.print("nhap nam sinh vao : ");
    namsinh = sc.nextint();
    } while (namsinh < 0);
    system.out.println("nhap diem cac mon ");
    do {
    system.out.print("diem mom toan : ");
    toan=sc.nextfloat();
    if(toan<0||toan>10){
    system.out.println("thang diem chi tu 0 - 10 moi ban nhap lai");
    }
    } while (toan<0||toan>10);
    do {
    system.out.print("diem mom ly : ");
    ly=sc.nextfloat();
    if(ly<0||ly>10){
    system.out.println("thang diem chi tu 0 - 10 moi ban nhap lai");
    }
    } while (ly<0||ly>10);
    do {
    system.out.print("diem mom hoa : ");
    hoa=sc.nextfloat();
    if(hoa<0||hoa>10){
    system.out.println("thang diem chi tu 0 - 10 moi ban nhap lai");
    }
    } while (hoa<0||hoa>10);
    system.out.println("

    =================================================" );
    system.out.println("===========xep loai ca nam=======================");
    system.out.println("sinh vien : "+hoten);
    system.out.println("sinh nam : "+namsinh);
    system.out.println("diem mon toan : "+toan);
    system.out.println("diem mon ly : "+ly);
    system.out.println("diem mon hoa : "+hoa);
    float dtb=(toan+ly+hoa)/3;
    system.out.println("diem trung binh 3 mon : "+dtb);
    if(dtb>=8){
    system.out.println("hoc luc gioi!");
    }else if(dtb>=6.5){
    system.out.println("hoc luc kha!");
    }else if(dtb>=5.0){
    system.out.println("hoc luc trung binh!");
    }else if(dtb>=3.0){
    system.out.println("hoc luc yeu!");
    }else{
    system.out.println("hoc luc kem");
    }
    }

    }
    <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></blockquote></div>
    </div>
    </div><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></blockquote></div>
    </div>
    </div>

  9. #69
    Ngày tham gia
    Feb 2015
    Bài viết
    0
    import java.awt.*;
    public class cau2 {
    public static void main(string[] args) {
    int n=8,i=0,j=0,dem;
    int [] a=(8,0,0,0,0,0,12,3);
    int [] b=new int[n];
    while(i<n){;
    if(a==0)
    i++;
    else{
    b[j]=a;
    i++;
    j++;
    dem++;
    }
    }
    for(j=0;j<dem;j++);
    system.out.print(b[j]+"");
    }
    }

    các pro tìm lỗi e với

  10. #70
    Ngày tham gia
    Apr 2016
    Bài viết
    0
    bài đây anh
    <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></blockquote></div>
    </div>
    </div>package duy.edu.hello;

    import java.util.scanner;

    public class hello {
    public static void main(string [] args){
    double toan,ly,hoa;
    int namsinh;
    string hovaten;
    scanner type = new scanner(system.in);
    system.out.println("nhập họ và tên :");
    hovaten = type.nextline();
    system.out.println("nhập năm sinh :");
    namsinh = type.nextint();
    system.out.println("nhập điểm toán :");
    toan = type.nextdouble();
    system.out.println("nhập điểm lý :");
    ly = type.nextdouble();
    system.out.println("nhập điểm hóa :");
    hoa = type.nextdouble();
    if ((toan>10) | (toan < 0) | (ly > 10) | (ly<0) |(hoa >10) |(hoa < 0)){
    system.out.println("bạn nhập điểm không đúng");
    }else{
    double tb = ((toan+ly+hoa)/3);
    if ((tb >= 5) & (tb < 6.5)){
    system.out.println("bạn" + hovaten + "là học sinh trung bình");
    }if((tb>=6.5) & (tb<8)){
    system.out.println("bạn" + hovaten + "là học sinh khá");
    }if((tb>=8) & (tb<=10)){
    system.out.println("bạn" + hovaten + "là học sinh giỏi");
    }if(tb<=5){
    system.out.println("bạn" + hovaten + "là học sinh dưới trung bình");
    }
    }
    }
    }

Trang 7 của 13 Đầu tiênĐầu tiên ... 56789 ... CuốiCuối

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
  •