<?php
/**
* We use an array to store all the numbers that can be divided by three
*/
$div_by_three = [];
/**
* fill the array with values that can be divided by three
*/
for($c=1; $c< 100; $c++) {
if($c % 3 === 0) {
$div_by_three[] = $c;
}
}
/**
* Sum the array values into one number
*/
echo "The sum of those dividable by three is $sum\n";
/**
* Divide the sum by array length
*/
$avg = $sum / count($div_by_three); echo "The average of those dividable by three is $avg\n";
PD9waHAKLyoqCiAqIFdlIHVzZSBhbiBhcnJheSB0byBzdG9yZSBhbGwgdGhlIG51bWJlcnMgdGhhdCBjYW4gYmUgZGl2aWRlZCBieSB0aHJlZQogKi8KJGRpdl9ieV90aHJlZSA9IFtdOwoKLyoqCiAqIGZpbGwgdGhlIGFycmF5IHdpdGggdmFsdWVzIHRoYXQgY2FuIGJlIGRpdmlkZWQgYnkgdGhyZWUKICovCmZvcigkYz0xOyAkYzwgMTAwOyAkYysrKSB7CiAgIGlmKCRjICUgMyA9PT0gMCkgewogICAgICAkZGl2X2J5X3RocmVlW10gPSAkYzsKICAgfQp9Ci8qKgogKiBTdW0gdGhlIGFycmF5IHZhbHVlcyBpbnRvIG9uZSBudW1iZXIKICovCiRzdW0gPSBhcnJheV9zdW0oJGRpdl9ieV90aHJlZSk7CmVjaG8gIlRoZSBzdW0gb2YgdGhvc2UgZGl2aWRhYmxlIGJ5IHRocmVlIGlzICRzdW1cbiI7CgovKioKICogRGl2aWRlIHRoZSBzdW0gYnkgYXJyYXkgbGVuZ3RoCiAqLwokYXZnID0gJHN1bSAvIGNvdW50KCRkaXZfYnlfdGhyZWUpOwplY2hvICJUaGUgYXZlcmFnZSBvZiB0aG9zZSBkaXZpZGFibGUgYnkgdGhyZWUgaXMgJGF2Z1xuIjsKCg==