Simple PHP algorithm problem (with extension), PHP algorithm problem extension
Simple PHP algorithm problem (to be perfected ...) )
Print only 0
The specific number is determined by the input parameter n
Print 00000 as N=5
Print n 0 based on n value
Print a line 0101010101010101010101
The specific number is determined by the input parameter n
such as test.php?n=3 printing 010
print 010101 based on n value ...
Implementation 1 00 111 0000 11111
For if implementation
Php for( $i= 0; $i< 10; $i++ ) { for( $j= 0; $j<= $i; $j++ ) { if( $i% 2 = = 0 ) { Echo' 0 ' ; } Else { Echo' 1 ' ; } } Echo'
' ;}?> for&if Statement Implementation
For switch implementation
Php for( $i= 0; $i< 10; $i++ ) { for( $j= 0; $j<= $i; $j++ ) { Switch( $j% 2 ) { Case' 0 ': Echo"0" ; Break ; Case' 1 ': Echo"1" ; Break ; } } Echo'
' ;}?> For&switch Statement Implementation
While if implementation
While switch implementation
Php $i= 0 ; while( $i< 10 ) { $j= 0 ; while( $j<= $i ) { Switch( $i% 2 ) { Case0: Echo' 0 ' ; Break ; Case1: Echo' 1 ' ; Break ; } $j++ ; } Echo'
' ; $i++ ;}?> While&switch Statement Implementation
Implementation 0 01 010 0101 ...
Implementation 0 01 012 0123 3210 210 10 0
Make a calculator.
such as Test.php?a=1&b=2&operator=jia output 3
such as Test.php?a=5&b=2&operator=jian output 3
such as Test.php?a=2&b=5&operator=cheng output 10
such as Test.php?a=6&b=3&operator=chu output 2
four-bit all-in-one computational function for subtraction processing
Advanced:
Number of daffodils
Bubble Sort Method
http://www.bkjia.com/PHPjc/1030384.html www.bkjia.com true http://www.bkjia.com/PHPjc/1030384.html techarticle Simple PHP algorithm problem (with expansion), PHP algorithm problem extension simple PHP algorithm (to perfect) only print 0 The number of parameters by the input parameter n, such as n=5 print 00000 according to the value of N printing ...