Advertisement
tei123

Untitled

Nov 29th, 2016
369
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.26 KB | None | 0 0
  1. <html>
  2. <body bgcolor="blue" name="kolor" >
  3.  
  4. <input type=text id="l1"/>
  5. <input type=text id="l2"/>
  6. <input type=text id="l3"/>
  7. <br>
  8. <button onClick="silnia()"> SILNIA </button>
  9. &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp &nbsp
  10. <button onClick="iloczyn()"> ILOCZYN PARZYSTYCH </button>
  11. &nbsp
  12. <button onClick="wyswietl()"> WYSWIETL </button>
  13.  
  14. <script>
  15.  
  16.  
  17.  
  18. function silnia()
  19. {
  20. var wynik=1;;
  21. var lib = parseInt(document.getElementById("l1").value);
  22.  
  23. for (lib;lib>0;lib--)
  24.  
  25. while (lib > 0 )
  26. {
  27. wynik = wynik * lib;
  28. lib = lib - 1;
  29. }
  30.  
  31. alert (wynik)
  32. };
  33.  
  34. function iloczyn()
  35. {
  36. var a = parseInt(document.getElementById("l1").value);
  37. var b = parseInt(document.getElementById("l2").value);
  38. var c = parseInt(document.getElementById("l3").value);
  39.  
  40. var ap=1;
  41. var bp=1;
  42. var cp=1;
  43. if (a%2==0)
  44. ap=a;
  45. if (b%2==0)
  46. bp=b;
  47. if (c%2==0)
  48. cp=c;
  49.  
  50. alert(ap*bp*cp);
  51.  
  52. };
  53.  
  54. function wyswietl()
  55. {
  56. var a = parseInt(document.getElementById("l1").value);
  57. var b = parseInt(document.getElementById("l2").value);
  58.  
  59. if (a>b)
  60. {
  61. var tmp;
  62. tmp = a;
  63. a = b;
  64. b = tmp;
  65. }
  66.  
  67.  
  68. if (b>30)
  69. {
  70. b=30;
  71. };
  72.  
  73.  
  74. for (a;a<=b;a++)
  75. {
  76. document.write(a)+" ";
  77. };
  78.  
  79.  
  80.  
  81. };
  82.  
  83. </script>
  84. </body>
  85. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement