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

Status
Not open for further replies.
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
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
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
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
422,542
Messages
7,127,172
Members
174,823
Latest member
caophu128

Most viewed of week

Most viewed of week

Back
Top Bottom