Created
August 14, 2015 09:32
-
-
Save VictorFursa/2ef489aaa776a496bf38 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //1 - Дано число n=1..100(Значение может быть от 1 до 100). | |
| //Заполнить массив $a так что бы количество у него было n - елементов, а значения елементов были 0 или 1 (rand(0,1)); | |
| $n = array(); | |
| $a = array(); | |
| for($i = 0; $i < 100; $i++){ | |
| $n[] = $i; | |
| if($i % 2){ | |
| $n[$i] = 1; | |
| }else{ | |
| $n[$i]=0; | |
| } | |
| $a[] = $n[$i]; | |
| } | |
| var_dump($a); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment