Advertisement
tei123

pszemo js

Oct 6th, 2016
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. <html>
  2. <head>
  3.  
  4. </head>
  5. <body>
  6. <script type="text/javascript">
  7. function dodawanie()
  8. {
  9. var a;
  10. var b;
  11. var z=0;
  12. a=prompt("1 liczba");
  13. b=prompt("2 liczba");
  14. a=parseInt(a);
  15. b=parseInt(b);
  16. if(a<b)
  17. {
  18. for(var i=a+1; i<b; i++)
  19. z+=i;
  20. document.write("Suma: "+z);
  21. }
  22. else
  23. {
  24. for(var i=b+1; i<a; i++)
  25. z+=i;
  26. document.write("suma: "+z);
  27. }
  28. }
  29. dodawanie();
  30. </script>
  31. </body>
  32. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement