program 6.
Title: Suppose someone has 100,000 of cash, every intersection need to pay the rules for the payment when he is more than 50,000 per cent of the amount of cash to be 5, if the cash is less than or equal to 50,000 per 5,000. Ask how many times this person can pass this intersection.
1 $money = 100000; 2 $i = 0; 3 while ($money >=) { 4if$money > 50000) { 5
$money *= 95/100; 6 Else if $money <= 50000) { 7$money -=; 8 } 9$i+ +; Ten oneecho$i . ' Second intersection
';
Program 7.
Title: Printing 99 multiplication table
1 for ($i$i$i+ +) {2for ($j$j$i $j++) {3echo$j$i$i*$j . ' '; 4 }5echo '
'; 6 }
Program 8.
Title: Hundred Money Hundred Chicken, Rooster 5 text Money One, hen 3 text money A only, chicken 1 text Money three only, with 100 money buys 100, ask, rooster, hen, chicken each a few?
1 $x 1 // Number of Cocks 2 $x 2 // Number of Hens 3 $x 3 // Number of chickens 4 for $x 1 $x 1 $x 1+ +) { 5for$x 2$x 2 <= (33-$x 1 $x 2+ +) { 6$x 3$x 1$x 2; 7 if (+ = ($x 1$x 2$x 3/3)) { 8echo$x 1 $x 2 $x 3 . '
'; 9 }ten }
Program 9.
Title: Number of primes within 1 to 100
1 $num = 2 ; 2 while ( $num <= ) { 3 if ( $num <= 3 ) { span> 4 echo $num . ' ; 5 } else { 6 for ( $j = 2; $j <= $num ; $j + + ) { 7 if ( $j = = $num ) { 8 echo $num . ' ; 9 } else if ( $num % $j = = 0 ) {
10
break
;
one
}
[
}
/
}
+
$num /span>++ ; }
The above introduces the PHP exercise two, including PHP, the contents of the exercises, I hope that the PHP tutorial interested in a friend helpful.