Posts

Write a program in php to print the multiplication table of 9

Write a program in php to print the multiplication table of 9: Answer : <? php define('a', 9);    for($i=1; $i<=10; $i++)    {      echo $i*a;      echo '<br>';      }   ?>

Write a php program to print factorial of a number

Write a php program to print factorial of a number: Answer: $num = 7;  $factorial = 1;  for ($x=$num; $x>=1; $x--)  {    $factorial = $factorial * $x;  }  echo "Factorial of $num is $factorial";  ?> Output : Factorial of 7 is 5040