HeatoNn Posted January 31, 2022 Report Share Posted January 31, 2022 cum pot afisa numerele de la 0 la n si suma lor,(n numar introdus de la tastatura ). Quote Link to comment Share on other sites More sharing options...
Nytro Posted January 31, 2022 Report Share Posted January 31, 2022 Poti folosi un <input> cu "id" ca sa citesti acel numar: <input type="text" id="nr"> <script>var nr = document.getElementById("nr").value;</script> Si ca sa le afisezi poti folosi un div: <div id="afisare"></div> var suma = 0; // Ca sa o calculezi var afisare = document.getElementById("afisare"); for(var i = 0; i < n; i++) { suma += i; afisare.innerHTML = afisare.innerHTML + i + "<br>"; } Ceva de genul ca idee, probabil sunt probleme in ce am scris. Quote Link to comment Share on other sites More sharing options...
spider Posted January 31, 2022 Report Share Posted January 31, 2022 iAr le faceti temele? astia nici mersi nu mai zic dupa, useri cu 1 post.. Quote Link to comment Share on other sites More sharing options...
HeatoNn Posted January 31, 2022 Author Report Share Posted January 31, 2022 2 hours ago, Nytro said: Poti folosi un <input> cu "id" ca sa citesti acel numar: <input type="text" id="nr"> <script>var nr = document.getElementById("nr").value;</script> Si ca sa le afisezi poti folosi un div: <div id="afisare"></div> var suma = 0; // Ca sa o calculezi var afisare = document.getElementById("afisare"); for(var i = 0; i < n; i++) { suma += i; afisare.innerHTML = afisare.innerHTML + i + "<br>"; } Ceva de genul ca idee, probabil sunt probleme in ce am scris. Mersi mult Quote Link to comment Share on other sites More sharing options...
HeatoNn Posted January 31, 2022 Author Report Share Posted January 31, 2022 1 hour ago, spider said: iAr le faceti temele? astia nici mersi nu mai zic dupa, useri cu 1 post.. Of of of ce nu mai pot unii de ceilalti. Quote Link to comment Share on other sites More sharing options...