Share your knowledge with other learners . . . Write As Guest

Print Table of any Number In PHP

📔 : PHP 🔗
Copy Fullscreen Close Fullscreen
<?php
  /*define a function ti print a table. 
  *@param $number:int.
  */
  function print_table($number)
  {
    echo "Table of $number : <br/>";
    for($i=1 ; $i<=10 ; $i++)
    {
      echo $i*$number."<br/>";
    }
  }

  /*now try to print a table*/
  print_table(10);
  print_table(14);
?>
Output
Table of 10 :
10
20
30
40
50
60
70
80
90
100
Table of 14 :
14
28
42
56
70
84
98
112
126
140

Related Topics :

Rahul Kumar

Rahul Kumar

Hi ! My name is Rahul Kumar Rajput. I'm a back end web developer and founder of learnhindituts.com. I live in Uttar Pradesh (UP), India and I love to talk about programming as well as writing technical tutorials and tips that can help to others.

Get connected with me. :) LinkedIn Twitter Instagram Facebook