Skip to content

Commit

Permalink
Added files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
juansoultrek committed Apr 19, 2016
1 parent f7ad1e6 commit 8213c64
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions FindDigits.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php
//https://www.hackerrank.com/challenges/find-digits
$handle = fopen ("php://stdin","r");
fscanf($handle,"%d",$t);
$remainder='';

for($i = 0; $i < $t; $i++)
{
fscanf($handle,"%d",$n);
$number=str_split($n);
$sum=0;
for ($j=0;$j<sizeof($number);$j++)
{
if ($number[$j]!=0)
{

if ($n%$number[$j]==0)
$sum= $sum+1;
}
}

$remainder=$remainder.$sum."\n";
}
echo $remainder;

?>

0 comments on commit 8213c64

Please sign in to comment.