1 Decembre
This commit is contained in:
parent
90b0334e67
commit
5ab50d58af
37
FRONTEND/JavascriptExo2.html
Normal file
37
FRONTEND/JavascriptExo2.html
Normal file
@ -0,0 +1,37 @@
|
||||
<!DOCTYPE,html>
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>JavascriptExo2</title>
|
||||
<script type="text/javascript">
|
||||
function somme(compter) {
|
||||
var i=1
|
||||
var somme=0;
|
||||
if (i<=0)
|
||||
{
|
||||
alert("Veuillez saisir un entier positif non nul.")
|
||||
}
|
||||
else
|
||||
{
|
||||
somme=i;
|
||||
document.write("Pour i = "+i+"--> somme = "+somme+"<br/>")
|
||||
while(i<compter)
|
||||
{
|
||||
i=i+1;
|
||||
somme=somme+i;
|
||||
document.write("\n"+"Pour i = "+i+"--> somme = "+somme+"<br/>");
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
var compter=0;
|
||||
compter=prompt("Donnez moi un entier positif non nul: ", "");
|
||||
somme(compter);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
Loading…
Reference in New Issue
Block a user