<head>
<title>UCLN</title>
</head>
<body>
<script language="JavaScript">
var a,b;
function UCLN(x,y){
while(x!=y) {
if(x>y) x=x-y;
else y=y-x;
}
return x;
}
a=prompt("Nhap gia tri a:");
b=prompt("Nhap gia tri b:");
document.write("Uoc chung lon nhat: " + UCLN(a,b))
document.write("Boi chung nho nhat: " + a*b/UCLN(a,b))
</script>
</body>
</html>Tags: Lập trình, JavaScript, BCNN, UCLN
Klik untuk melihat kode: :) =( :s :D :-D ^:D ^o^ 7:( :Q :p T_T @@, :-a :W *fck* x@