<?php
$arr=array(10,1,4,5,7,8,9,3,2);
$sum=0;
for($i=0;$i<=10;$i++){
$sum=$sum+$i;
}
$newsum=0;
foreach($arr as $arr){
$newsum=$newsum+$arr;
}
$missingnumber=$sum-$newsum;
echo $missingnumber;
?>
$arr=array(10,1,4,5,7,8,9,3,2);
$sum=0;
for($i=0;$i<=10;$i++){
$sum=$sum+$i;
}
$newsum=0;
foreach($arr as $arr){
$newsum=$newsum+$arr;
}
$missingnumber=$sum-$newsum;
echo $missingnumber;
?>
No comments:
Post a Comment