jueves, 9 de marzo de 2017

Crear rombo con asteriscos

<!DOCTYPE>
<html lang='es'>
    <html>
        <head>
            <title>rombo</title>
                <meta charset='UTF-8'/>
                <meta name='description' content='Página web'>
                <meta name='keywords' content=', rombo,piramide, javascript'>
           
        </head>
        <body>
        <script type="text/javascript">
        //declaracion variables
            var f, c;
            for(f=1;f<=6;f++)
            {
                for(c=1;c<=6-f;c++)
                    document.write("&nbsp");// espacio
                for (c=1;c<=f;c++){
                    document.write("*");
                    }
                    document.write("</br>");
            }
            for(f=5;f>=1;f--)
            {
                for(c=1;c<=6-f;c++)
                    document.write("&nbsp");
                for (c=f; c>=1;c--){
                    document.write("*");
                    }
                document.write("</br>");
                   
            }
           
           
           
           
           
               
       
        </script>
    </body>
</html>

No hay comentarios:

Publicar un comentario