assignment Person
pragma solidity^0.4.0;
contract Persons{
struct Person{
string name;
uint age;
}
Person[] man;
function addPerson(string _name, uint _age)public {
man.push(Person(_name,_age));
}
function getAverageAge()view public returns(uint){
uint len = man.length;
uint sum = 0;
for(uint i = 0; i < len; ++i){
sum += man[i].age;
}
return sum/len;
}
}