Share
Viết chương trình tìm ước chung lớn nhất của 2 số nguyên.In kết quả ra màn hình
Question
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Answers ( )
Program bai_tap;
Uses crt;
Var M,N: integer;
Begin
clrscr;
write (‘Nhập M, N= ‘);
readln (M,N);
While M <> N do
if M >N then M:= M – N else N:= N – M;
writeln( ‘ UCLN = : ‘, M);
readln
End.
Program UCLN;
uses crt; var a,b : integer;
begin write (‘nhap so a la ‘);
readln (a);
write (‘nhap so b la ‘);
readln (b);
while a < > b do
if a >b then a := a – b else b := b – a ;
write ( ‘ UCLN la :’ , a );
readln
end.
~~~~~~~~~~~~~~~~~~ Chúc bn học tốt ~~~~~~~~~~~~~~~~~
Để tìm câu trả lời chính xác các em hãy tham khảo tìm ước chung của 2 số các nguồn hoc24.vn, lazi.vn, hoidap247.com để thầy cô và các chuyên gia hỗ trợ các em nhé!