PROBLÈME




(Le code source)

<script language="JavaScript">
<!-- ;
//----------------------------------------algorithme--------------------------------------------
var i = 16;
n2=12;
n1=16;
while(i>0)
{
a=(n2/i);
b=(n1/i);
x=(n2%i);
y=(n1%i);
e=i*a;
f=i*b;
invite="invité";
if (i>1){
fin="s";
}
if (i<2){
fin=" ";
}
if ((x==0) &&(y==0)){
document.write(a+" x "+i+" = "+e+"<br>");
document.write(b+" x "+i+" = "+f+"<br>");
document.write("Solution possible : Il y a "+i+" "+invite+fin+".<BR>Chaque invité a "+a+" caramels et "+b+" chocolats.<BR><BR>");
}
i--;
}
//------------------------------------------------------------------------------------
document.write();
// end hide -->
</script>