运用js写九九乘法表

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <script>
    //for循环九九乘法表
    for(var a=0;a<=9;a++){
        for(var b=1;b<=a;b++){
            document .write(a+"*"+b+"="+(a*b)+" ");
        }document.write("<br>");
        
    }

        document.write("<hr>");
        //while循环九九乘法表
        var c=0;
        while(c<9){
            c++;
            var d=0;
        while(d<c){
            d++;
            document.write(c+"*"+d+"="+(c*d)+" ")
        }document.write("<br>");
    }
    document.write("<hr>");
    //do-while循环
    var e=0;
    do{
        e++;
        var f=0;
    do{
        f++;
        document.write(e+"*"+f+"="+(e*f)+" ")
    }while(f<e)
    document.write("<br>");}while(e<9)

    </script>
</body>
</html>
具体效果图如下:
运用js写九九乘法表

 

 

运用js写九九乘法表

上一篇:关于C#静态构造函数的几点说明


下一篇:WARNING [Project: :app] To shrink resources you must also enable ProGuard