Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!DOCTYPE html>
- <html>
- <head>
- <title></title>
- <link rel="stylesheet" type="text/css" href="estilo.css" media="">
- </head>
- <body>
- </body>
- </html>
- <?php
- function main(){
- $cantidad=50;
- imprimir($cantidad);
- }
- function getEdades($can){
- $sum = 0;
- $cantMen = 0;
- $cantMay = 0;
- echo "Listado de Edades:<br>";
- for ($i=0; $i < $can; $i++) {
- $edad=rand(15,80);
- echo "$edad<br>";
- $sum += $edad;
- if ($edad < 18){
- $cantMen += 1;
- }else{
- $cantMay += 1;
- }
- }
- $prom = $sum/$i;
- echo "Cantidad de personas Menores: ".$cantMen;
- echo "<br>";
- echo "Cantidad de personas Mayores: ".$cantMay;
- echo "<br>";
- return $prom;
- }
- function imprimir($cantidad){
- echo "Imprimir Resultados<br>";
- echo "***********<br>";
- echo "<br>";
- $promedio = getEdades($cantidad);
- echo "El promedio de edades es: ".$promedio;
- }
- //Mostrar Información de las funciones
- main();
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement