JavaScript Lab 3


// Print prime Numbers...
let range = 1;


while (range < 10) {

    let count = 0; 
    for (let i = 1; i <= range ; i++) {
        if (range % i == 0) {
            count++;
        }
    }
    if (count == 2) {
        console.log(range);
    }
    range++;
}



// Printing Star patten

for (let i = 1; i <= 5; i++) {
    console.log(new Array(i + 1).join("*"));
}

Comments

Popular posts from this blog

5th sem OOPJ Write a program to count the number of words that start with capital letters.

5th sem OOPJ Write a program to enter two numbers and perform mathematical operations on them.

5th sem OOPJ Write a program to convert rupees to dollar. 60 rupees=1 dollar.