Computer Science, asked by lemusharmabdn, 20 days ago

Write a java script program to print first 10 natural numbers by using for loop, while loop and do while loop?​

Answers

Answered by purveshKolhe
10

\huge{\red{\underbrace{\overbrace{\green{\mathfrak{answer::}}}}}}

\orange{\underline{\bf{For-}}}

for (var i = 1; i <= 10; i++) {

    console.log(i);

}

-------------------------------

\orange{\underline{\bf{While-}}}

var i = 1;

while (i <= 10) {

    console.log(i);

    i++

}

-------------------------------

\orange{\underline{\bf{Do..While-}}}

var i = 1;

do {

    console.log(i);

    i++

} while (i <= 10)

Hope it helps...

Similar questions