5 comments:

  1. $str=$_POST['num'];
    $y=explode(",",$str);
    $sum=0;
    for($i=0;$i<=sizeof($y);$i++)
    {
    $sum=$sum+$y[$i];
    }
    echo $sum."
    ";
    $mean=$sum/sizeof($y);
    echo $mean;

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. $sum=0;
    $arr=array();
    for($i=0;$i";
    echo "Mean=$sum/sizeof(arr)";

    ReplyDelete
  5. php
    $n=$_POST['num'];
    $str=$_POST['arr'];
    $x=explode(',',$str);
    $sum=0;
    for($i=0;$i<$n;$i++)
    {$sum=$sum+$x[$i];
    }
    print_r($sum);
    echo"
    ";
    $avg=$sum/$n;
    print_r($avg);
    ?>

    ReplyDelete