Bonjour,
je n arrive pas a additionner la variable "a" + la variable "r" ensemble, le résultat est du genre 20+7= 207 au lieu de 27.
Pouvez vous me donner un conseil
Merci d'avance
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49 <html> <head> <SCRIPT LANGUAGE=JavaScript> function calcul() { var r=(prompt("Entrez le rayon :",r)); var n=(prompt("Entrez la quantité :",n)); var a=new Array(1); for(i=1 ; i<=n ; i++) a.push(prompt("Entrez nombres N° :"+i+"" )) wdow=open("","","height=820,width=450","scrollbars=1"); wdow.document.write(""); wdow.document.writeln("Nombre d'entrée = "+n+""); wdow.document.writeln("<BR>"+"Le rayon est de = "+r+""); wdow.document.writeln("<br>"); for(i=1 ; i<=n ; i++) { a[i] = r+a[i]; wdow.document.writeln("<BR>"+"Nombres N° "+i+"="+a[i]); } } </SCRIPT> </head> <body> <form name="formu"> <table border="0" width="100%"> <tr> <td width="33%"></td> <td width="34%"><center><INPUT TYPE=button ONCLICK="calcul( );" VALUE="Calculer"></center></td> <td width="33%"> </td></tr></table> </form> </body> </html>
Partager