Loop Entry Control Vs Loop Exit Control: ========================================= Loop Entry Control: condition: Loop Exit Control: { }condition; while ==> Loop Entry Control DO-WHILE Loop: ============== Loop Exit Control Statement Syntax: Initialization do{ statement-1; statement-2; update; } while(condition); // WAP IN JS TO PRINT ALL NUMBERS FROM 10 TO 1 USING DO-WHILE. let start = 10; do{ console.log(start); start--; } while(start > 0); ============================================ Conditions in Loops: ==================== while(condition) { if(condition-1) { if-block } else { else block } update; } ================================== // WAP TO PRINT ALL EVEN NUMBERS IN JAVASCRIPT FROM 100 TO 80 USING DO WHILE. let start = 100; do{ if(start % 2 == 0) { console.log(start); } start--; }while(start >= 80); ============= // WAP TO CHECK WHETHER THE GIVEN NUMBER IS PALINDROME NUMBER OR NOT. /* reverse(num) == num reverse of number 121 ==> 1 X 10^2 + 2 X 10^1 + 1 X 10^0 121 / 10 ==> rem = 1, quo = 12 reverse_number = reverse_number * 10 + ind_dig */ var n = 1231; var num = n; reverse = 0 while(n > 0) { digits = n % 10; digits// 1 2 2 1 reverse = reverse * 10 + digits; // 1 12 122 1221 n = Math.floor(n / 10); // 122 12 1 0 } if(reverse == num) { console.log("It is a palindrome number."); } else { console.log("It is not a palindrome number."); } ================================== for loop: ========= ==> Loop Entry Control Statement Syntax_1: ========= initialization; for(;condition;update) { loop body; } Syntax_2: ========= for(initialization;condition;update) { loop body; } Syntax_3: ========== initialization for(;condition;) { loop body; update; } // WAP TO PRINT THE SUM OF ALL ODD NUMBERS FROM 1 TO 20 var sum_odd = 0; for(let s = 1;s <= 20;s++){ // logic to find all odd numbers if(s % 2 != 0) { sum_odd += s; // 1 4 } } console.log("The Sum of all Odd numbers = "+sum_odd); Armstrong number: ================ Sum of nth-power of individual digits of a number which equals to original number ==> Armstrong number. xyz ==> x^3 + y^3 + z^3 == xyz abcd ==> a^4 + b^4 + c^4 + d^4 == abcd pqrst ==> p^5 + q^5 + r^5 + s^5 + t^5 == pqrst // Assignment: =============== WAP IN JAVASCRIPT TO CHECK WHETHER THE GIVEN NUMBER IS ARMSTRONG NUMBER OR NOT.