SHARE
TWEET

Untitled

a guest Oct 21st, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $wiersz = file("wyniki.txt");
  3. echo $wiersz[5];
  4.  
  5. $sumaHEX = 0;
  6. $suma_a = 0;
  7.  
  8. for ($i=0;$i<count($wiersz);$i++){
  9.     if(is_numeric($wiersz[$i][0])){ // sprawdzenie czy pierwszy znak z wiersza to liczba
  10.         $sumaHEX += explode(chr(9), $wiersz[$i])[2]; // 0,1,2 - hexdec
  11.         $suma_a += explode(chr(9), $wiersz[$i])[3]; // ...3 - a[i]
  12.     }
  13. }
  14. $sumaHEX /= 41;
  15. $suma_a /= 41;
  16.  
  17. echo "<p> Średnia hex, wynosi: $sumaHEX <br>";
  18. echo "Średnia a, wynosi: $suma_a </p>";
  19.  
  20. $suma_a /= $sumaHEX;
  21. $suma_a *= 1E6;
  22. echo "<p> Przeskalowany stosunek średnich wynosi: $suma_a </p>";
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