Home | Computer Science

Write a programmer using switch

<html>
<body>
<?php
function loop(){
$a=0;
do
{

echo "hello<br>";

$a++;
}
while($a<=5);
}
loop();

?>
</body>
</html>

Output:-
hello
hello
hello
hello

 Write a programme using function with loop

<html> <body>

<?php
function loop(){

$af=1;

$ae=0;

$a; $b;

$e=0;

$f=0;

switch ($af)

{ case 1:

for($a=0;$a<=5;$a++){

for($b=0;$b<=$a;$b++){

echo "%"; }

echo "<br>"; }

case 2:

$e=0;

while($e<=5){

$f=0;

while($f<=$e){

echo "#"; $f++; }

echo "<br>"; $e++; }

case 3:

do

{ $be=0;

do{

echo "*"; $be++; }

while($be<=$ae); echo "<br>"; $ae++; } while($ae<=5);
case 4:
$a;$b;
for($a=0;$a<=5;$a++){
for($b=5;$b>=$a;$b--){
echo "&";
}
echo "<br>";
}
}
}loop();     ?> </body> </html>

output:- 

%
%%
%%%
%%%%
%%%%%
%%%%%%
#
##
###
####
#####
######
*
**
***
****
*****
******
&&&&&&
&&&&&
&&&&
&&&
&&
&