chương trình sau hãy tìm những lỗi sai và sửa lại cho đúng
Program H C_N
Uses Crt
Var a,b,s,cv:=real;
Begin
While(‘Nhap chieu dai-‘);readln(a)
Write(‘Nhap chieu rong=’);readln()
s=axb
cv:(a+b):2;
Writeln(‘dien tich hinh chu nhat la:’,S:6:2);
Writeln(‘Chu vi hinh chu nhat:’,cv:6:2);
Readln
End
Program H C_N
Uses Crt
Var a,b,s,cv:=real;
Begin
While(‘Nhap chieu dai-‘);readln(a)
Write(‘Nhap chieu rong=’);readln()
s=axb cv:(a+b):2;
Writeln(‘dien tich hinh chu nhat la:’,S:6:2);
Writeln(‘Chu vi hinh chu nhat:’,cv:6:2);
Readln
End
Sửa bài:
Program H_C_N
Uses crt;
Var a,b,s,cv:real;
Begin
Write(‘Nhap chieu dai:’);readln(a)
Write(‘Nhap chieu rong:’);readln(b)
s=a*b
cv:=(a+b)*2;
Writeln(‘dien tich hinh chu nhat la:’,s:a*b);
Writeln(‘Chu vi hinh chu nhat:’,cv:(a+b)/2);
Readln;
End.
Program H C_N →Program H_C_N;
Uses Crt →Uses crt;
Var a,b,s,cv:=real; →Var a,b,c,s,cv:real;
Begin →Begin
Clrscr;
While(‘Nhap chieu dai-‘); → Write(‘Nhap chieu dai=’);
readln(a) →Readln(a);
Write(‘Nhap chieu rong=’);
readln() →Readln (b);
s=axb →s:=a*b;
cv:(a+b):2; →cv:=(a+b)*2;
Writeln(‘dien tich hinh chu nhat la:’,S:6:2);→Writeln(‘Dien tich hinh chu nhat la:’,s:6:2);
Writeln(‘Chu vi hinh chu nhat:’,cv:6:2);
Readln →Readln;
End →End.
#LAMTOTNHA