Tuesday, April 7, 2020

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

Featured posts

वन्दे मातरम्

 वन्दे मातरम् 🇮🇳   अर्थ: "मैं तुझे नमन करता हूँ, माँ"  ये सिर्फ एक नारा नहीं, भारत माँ के प्रति श्रद्धा और प्रेम है। इसके बारे म...

Popular posts