hỗ trợ em bài pascal mí pro ơi ! !

Status
Not open for further replies.

nhtoan

Senior
Joined
Oct 8, 2011
Messages
716
Reactions
263
MR
0.000
Chat with me via Skype
mấy bài cơ bản này tự suy nghĩ mà làm đi bạn
dùng mấy lệnh write với if else là xong mà
 
Upvote 0

liachogay

Banned
Joined
Aug 18, 2012
Messages
116
Reactions
102
MR
0.000
Program Xep_loai_HL;
Uses crt;
Var DTB:Real;
Begin
clrscr;
write('Nhap DTB cua hoc sinh = ');
readln(DTB);
If DTB > = 8 then
write('Xep loai gioi')
else
If DTB > = 6.5 then
write('Xep loai kha')
else
If DTB > = 5 then
write('Xep loai TB')
else
write('Xep loai yeu - kem');
Readln;
End.
không nhớ thì bài này là bài lớp 8 em học cách đây mấy tuần rảnh post lên cho chủ thớt :binhsua14:
 
Upvote 0

dragonmachine

Senior
Joined
Jul 6, 2010
Messages
706
Reactions
547
MR
0.000
Program Xep_loai_HL;
Uses crt;
Var DTB:Real;
Begin
clrscr;
write('Nhap DTB cua hoc sinh = ');
readln(DTB);
If DTB > = 8 then
write('Xep loai gioi')
else
If DTB > = 6.5 then
write('Xep loai kha')
else
If DTB > = 5 then
write('Xep loai TB')
else
write('Xep loai yeu - kem');
Readln;
End.

Thêm Var DTH, DLT và DTB = (DTH + DLT)/2
 
Upvote 0
câu này mình hok hỉu ! mình chạy bài trên bị lỗi 3 chỗ hjc

- Nếu điểm trung bình >=8 xếp loại giỏi
- Nếu điểm trung bình >=7 xếp loại khá
- Nếu điểm trung bình >=5 xếp loại TB

Ngược lại để trống là ý gì ta ??

- - - Updated - - -

à mình hỉu rùi bài của bạn chưa nhập điểm lý thuyết và thực hành hjc
 
Upvote 0
minh sữa lại bài của cậu như sau :

hok pik lỗi chỗ nào mà vẫn ko chạy dc


Program Xep_loai_HL;
Uses crt;
Var DTB,DLT,DTH:Real;
Begin
clrscr;
write('Nhap DTH cua hoc sinh = ');
readln(DTH);
write('Nhap DLT cua hoc sinh = ');
readln(DLT);
DTB := (DTH + DLT)/2
If DTB > = 8 then
write('Xep loai gioi')
else
If DTB > = 6.5 then
write('Xep loai kha')
else
If DTB > = 5 then
write('Xep loai TB')
else
write('Xep loai yeu - kem');
Readln;
End.
 
Last edited by a moderator:
Upvote 0

mrkentvlvn

Senior
Joined
Jul 18, 2011
Messages
405
Reactions
231
MR
0.000
Chat with me via Skype
tp.PNG

chịu khó đánh lại nha a
 
Upvote 0
minh sữa lại bài của cậu như sau :

hok pik lỗi chỗ nào mà vẫn ko chạy dc


Program Xep_loai_HL;
Uses crt;
Var DTB,DLT,DTH:Real;
Begin
clrscr;
write('Nhap DTH cua hoc sinh = ');
readln(DTH);
write('Nhap DLT cua hoc sinh = ');
readln(DLT);
DTB := (DTH + DLT)/2
If DTB > = 8 then
write('Xep loai gioi')
else
If DTB > = 6.5 then
write('Xep loai kha')
else
If DTB > = 5 then
write('Xep loai TB')
else
write('Xep loai yeu - kem');
Readln;
End.

Thiếu dấu ; sau DTB: = (DTH + DLT)/2.
 
Upvote 0
7e7f70a3b972a5254c82518c69f74d2b_53997023.145.png



c2d45276483e192337ee119b38239db1_53997124.146.png

Code:
program KQ;
uses crt;
var
    dtb,lt,th:real;
    hoten,sbd,ketqua,xeploai:string;


Begin
clrscr;
write('Nhap SBD : '); readln(sbd);
write('ho ten :');readln (hoten);
write('Nhap diem thuc hanh: ');readln(th);
write('Nhap diem ly thuyet: ');readln(lt);


dtb:=(lt+th)/2;

if dtb>= 5 then
   begin
        ketqua:='Dau';
        if dtb >=8 then xeploai:='Gioi'
        else if dtb >=6.5 then xeploai := 'kha'
        else ketqua := 'Trung binh';
   end
else
   begin 
         ketqua := 'rot'; 
         xeploai:='kem';
   end;
    clrscr;
    writeln('----KET QUA----');
writeln('sbd: ', sbd);
writeln('ho ten: ', hoten);
writeln('diem ly thuyet: ',lt:10:2);
writeln('diem th: ',th:10:2)  ;
writeln('diem tb: ',dtb:10:2);
writeln ('Ket qua: ',ketqua);
writeln('xep loai: ',xeploai);
writeln('-------------------');
writeln('enter de ket thuc');

readln
End.

done!!
 
Last edited by a moderator:
Upvote 0
Status
Not open for further replies.

Announcements

Today's birthdays

Forum statistics

Threads
423,892
Messages
7,134,595
Members
176,355
Latest member
truongvokyz

Most viewed of week

Most discussed of week

Most viewed of week

Most discussed of week

Back
Top Bottom