programming-examples/php/_Basics/PHP program to find factor of any number.php

17 lines
307 B
PHP
Raw Normal View History

2019-11-15 12:59:38 +01:00
// Write a program to find factor of any number
<?php
if(isset($_POST['sub']))
{ $j=0;
$factor=array();
$num=$_POST['nm1'];
for($i=1;$i<=$num;$i++)
{
if($num%$i==0)
{
$j++;
$factor[$j]=$i;
}
}
}
?>