Maharashtra's Most Trusted
20 Most Imp Programs From CSS Chapter 1
Basics of Java Script Programming
If-Else Condition: Write a JavaScript program to check if a given number is positive, negative, or zero using an
if-else
statement.Nested If-Else Condition: Write a JavaScript program to determine the largest among three given numbers using nested
if-else
statements.If-Else with Logical Operators: Write a JavaScript program to determine whether a given year is a leap year or not using an
if-else
statement and logical operators.Switch Statement for Day of the Week: Write a JavaScript program that takes a number (1-7) as input and prints the corresponding day of the week using a
switch
statement.Switch Statement for Grading System: Write a JavaScript program that takes a student’s score (0-100) as input and uses a
switch
statement to determine the grade (A, B, C, D, F).For Loop – Sum of Numbers: Write a JavaScript program that calculates the sum of all numbers from 1 to 100 using a
for
loop.While Loop – Factorial Calculation: Write a JavaScript program to calculate the factorial of a given number using a
while
loop.Do-While Loop – Number Reversal: Write a JavaScript program to reverse a given number using a
do-while
loop.For Loop with Nested If-Else: Write a JavaScript program to print all the prime numbers between 1 and 50 using a
for
loop andif-else
statements.Loop with Switch for Month Names: Write a JavaScript program that takes a number (1-12) as input and prints the corresponding month name using a
for
loop and aswitch
statement.Prime Number Check with Nested Loop:
Write a JavaScript program to check whether a given number is a prime number. Use afor
loop to check divisibility and anif-else
statement for the result.Fibonacci Sequence:
Write a JavaScript program to print the firstn
Fibonacci numbers using afor
loop. Use anif-else
condition to handle the first two numbers.Palindrome Number Check:
Write a JavaScript program to check if a given number is a palindrome (reads the same forward and backward). Use a combination of a loop andif-else
logic.Switch with Multiple Cases for Arithmetic Operations:
Write a JavaScript program that performs basic arithmetic operations (addition, subtraction, multiplication, division) based on user input. Use aswitch
statement to handle the operations, and handle invalid operations with a default case.Armstrong Number Check:
Write a JavaScript program to check whether a given number is an Armstrong number (e.g., 153 = 1³ + 5³ + 3³). Use a loop to separate digits andif-else
for the final check.Calculate GCD of Two Numbers:
Write a JavaScript program to find the greatest common divisor (GCD) of two numbers using a loop andif-else
logic.Nested Loops for a Pattern:
Write a JavaScript program that uses nestedfor
loops to print a pyramid pattern of stars (*
). The number of rows in the pyramid should be based on user input.Sum of Digits Using a Loop:
Write a JavaScript program to calculate the sum of digits of a given number using a loop. Useif-else
logic to separate the digits.Factorial Using Recursion with If-Else:
Write a JavaScript program that calculates the factorial of a number using recursion. Use anif-else
statement to define the base and recursive cases.Switch with Range Cases:
Write a JavaScript program that categorizes a number as “small”, “medium”, or “large” based on its value using aswitch
statement. Use multiple cases (e.g., 1-10 for small, 11-20 for medium, etc.) for each category.
end of part 1 -------->
Explore Other Chapters