Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $wiersz = file("wyniki.txt");
- echo $wiersz[5];
- $sumaHEX = 0;
- $suma_a = 0;
- for ($i=0;$i<count($wiersz);$i++){
- if(is_numeric($wiersz[$i][0])){ // sprawdzenie czy pierwszy znak z wiersza to liczba
- $sumaHEX += explode(chr(9), $wiersz[$i])[2]; // 0,1,2 - hexdec
- $suma_a += explode(chr(9), $wiersz[$i])[3]; // ...3 - a[i]
- }
- }
- $sumaHEX /= 41;
- $suma_a /= 41;
- echo "<p> Średnia hex, wynosi: $sumaHEX <br>";
- echo "Średnia a, wynosi: $suma_a </p>";
- $suma_a /= $sumaHEX;
- $suma_a *= 1E6;
- echo "<p> Przeskalowany stosunek średnich wynosi: $suma_a </p>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement