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

17 lines
307 B
PHP
Raw Permalink Normal View History

2019-11-18 14:44:36 +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;
}
}
}
?>