Wednesday 2 August 2023

Javascript: How to Print Tables from 1 to 20 using JavaScript?

Javascript: How to Print Tables from 1 to 20 using JavaScript?

The simple way to print the Math tables from 1 to 20 using javascript. This is basic logic of loops in javascript. 

Sample:

let tableNo = 2;
console.log("Multiplication Table of", tableNo, "is:");
for(let i=1; i<=10; i++)
{
    console.log(tableNo +"*"+ i +"="+ tableNo*i);
    if(i==10 && tableNo<20)
    {
        tableNo = tableNo+1;
        i=0;
        console.log("=================================");
        console.log("Multiplication Table of", tableNo, "is:");
    }
}




 OutPut : The out put like this

Quick Solutions

More

About Us

Hello!
I`m Sharath.
I'll design & develop dynamic websites,web applications, and anything related to web. I'll develop projects in JAVA,.Net, PHP and Android Apps .

Contact Us

Sharath Babu
Company : SLS Tech Services.
URL : SLS Tech Services
Top