SHARE
TWEET

Untitled

a guest Dec 3rd, 2019 81 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. </head>
  6. <body>
  7.     <!--WYJŚCIE-->
  8.     <div id="div1"></div>
  9.     <div id="div2"></div>
  10. <script>
  11. var T=[1,2,3,4,5];
  12. var dane_wejsciowe="";
  13. var suma = 0;
  14. for(var indeks in T){
  15.     dane_wejsciowe=dane_wejsciowe+T[indeks]+"<br/>";
  16.     suma=suma+T[indeks];
  17. }
  18. document.getElementById("div1").innerHTML="Wartości elementów składowych tablicy:<br/>"+dane_wejsciowe;
  19. document.getElementById("div2").innerHTML="Suma elementów: " + suma;
  20.    
  21.    
  22. </script>
  23. <script>
  24. function przetwarzanie(){
  25.     var input1=document.getElementById("input1");
  26.      var input2=document.getElementById("input2");
  27.      var input3=document.getElementById("input3");
  28.      var input4=document.getElementById("input4");
  29.     var div1=document.getElementById("div1");
  30.     var div2=document.getElementById("div2");
  31.     var div3=document.getElementById("div3");
  32.     var div4=document.getElementById("div4");
  33.     var suma=0,srednia,maks,min;
  34.     var tablica=[]
  35.     tablica[0]=Number(input1.value);
  36.     tablica[1]=Number(input2.value);
  37.     tablica[2]=Number(input3.value);
  38.     tablica[3]=Number(input4.value);
  39.     for(var i =0; i <tablica.length;i++){
  40.     if(i==0){
  41.         maks=tablica[i];
  42.         min=tablica[i];
  43.     }
  44.         else{
  45.             if(tablica[i]>maks)maks=tablica[i];
  46.              if(tablica[i]<min)min=tablica[i];
  47.         }
  48.         suma = suma + tablica[i];
  49.     }
  50.    
  51.     srednia=(suma/4).toFixed(2);
  52.     div1.innerHTML
  53. }    
  54.    
  55.    
  56.    
  57.    
  58. </script>
  59. </body>
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72.  
  73.  
  74.  
  75.  
  76.  
  77.  
  78.  
  79.  
  80. </html>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top