Loop

Loop is logical process which is execute some statement with in a particular area according to specific condition.

Example in PHP
<?php

//for loop
for($i=1;$i<=10;$i++)
{
	echo $i;
}
//while loop

$i=1;
while($i<=10){
	echo $i;
	$i++;
}
// Do while loop

$i=1;
do{
	echo $i;
	$i++;
}while($i<=10);

?>

Practice Questions

  • Input a number and print it factorial.
  • Input a number and print it sum of digits.
  • Input a number and print it second highest digits.
  • Input a number and print it middle digits.
  • Input a decimal number and print it binary number.
  • Input a number and check it is prime number or not.
  • Input a number and check it is perfect number or not.
  • Input a number and check it is polydram number or not.
  • Input a number and check it is Automatic number or not.
  • Genarate fibonic series.
  • Print it.
    1
    1 2
    1 2 3
    1 2 3 4
    1 2 3 4 5
    
  • Print it.
    1
    2 2
    3 3 3
    4 4 4 4
    5 5 5 5 5
    
  • Print it.
    1
    2 3
    4 5 6 
    7 8 9 10
    11 12 13 14
    
  • Print it.
            1
          1 1
        1 1 1
      1 1 1 1
    1 1 1 1 1
    
  • Print it.
            1
          1 1 1
        1 1 1 1 1
      1 1 1 1 1 1 1
    1 1 1 1 1 1 1 1 1
    
  • Print it.
            1
          1 1 1
        1 1 1 1 1
      1 1 1 1 1 1 1
    1 1 1 1 1 1 1 1 1
      1 1 1 1 1 1 1
        1 1 1 1 1
          1 1 1
    	1
    

© 2014 Powered By