Advertisement
fafciox

Praca domowa #1

Apr 10th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <html>
  2. <head>
  3. <title>uyhvjbl</title>
  4. <meta charset="utf-8">
  5.  
  6.  
  7. <script type="text/javascript">
  8.  
  9. var zzx=new Array();
  10.  
  11.  
  12. function podaj()
  13. {
  14. var ilosc=prompt("Podaj ilosc liczb");
  15.    
  16.     for(var i=0; i<ilosc; i++)
  17.         zzx[i]=parseInt(prompt("Podaj ilość liczb"));
  18. }
  19.  
  20. function wypisz()
  21. {
  22. document.write("Podane liczby: ");
  23.     for(var i=0; i<zzx.length; i++)
  24.         document.write(zzx[i]+"  ");
  25.  
  26.  
  27. }
  28.  
  29. function przelicz()
  30. {
  31.    
  32.     document.write("<br>Przeliczone liczby:<br>");
  33.     for (var i=0; i<zzx.length; i++)
  34.         if ((zzx[i]%2)==0)
  35.             {
  36.             var x=(zzx[i]+128);
  37.             document.write(x+", ");
  38.             }
  39.            
  40.         else
  41.             {
  42.             document.write(zzx[i]+", ");
  43.             }
  44. }
  45.  
  46.  
  47. podaj();
  48. wypisz();
  49. przelicz();
  50. </script>
  51. </head>
  52. <body>
  53. </body>
  54. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement