# Simple PHP algorithm problem (with extension), PHP algorithm extension _php tutorial

Source: Internet
Author: User

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

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 ...

• Related Keywords:
Related Article

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.