cours-MDS/b1-algo/javascript-1.html

44 lines
741 B

<html><body><pre>
<script>
document.write("mettre 2 dans une variable");
/* Pseuso code :
variable a entier;
a=2;
afficher a;
*/
var a /* entier */;
a=2;
document.write(a);
document.write("\nmultiplier par addition");
/* Pseuso code :
variable opD,opG,resultat entier;
resultat = 0;
opD=2;
opG=3;
pour i=0; i<opD; i++
resultat = resultat+opG;
fin pour;
afficher resultat;
*/
var opD,opG,resultat;
resultat=0;
opD=2;
opG=3;
for (var i = 0; i < opD; i++) {
resultat=resultat+opG;
}
document.write("\n");
document.write(resultat);
</script></pre>
</body></html>