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-elsestatement.Nested If-Else Condition: Write a JavaScript program to determine the largest among three given numbers using nested
if-elsestatements.If-Else with Logical Operators: Write a JavaScript program to determine whether a given year is a leap year or not using an
if-elsestatement 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
switchstatement.Switch Statement for Grading System: Write a JavaScript program that takes a student’s score (0-100) as input and uses a
switchstatement 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
forloop.While Loop – Factorial Calculation: Write a JavaScript program to calculate the factorial of a given number using a
whileloop.Do-While Loop – Number Reversal: Write a JavaScript program to reverse a given number using a
do-whileloop.For Loop with Nested If-Else: Write a JavaScript program to print all the prime numbers between 1 and 50 using a
forloop andif-elsestatements.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
forloop and aswitchstatement.Prime Number Check with Nested Loop:
Write a JavaScript program to check whether a given number is a prime number. Use aforloop to check divisibility and anif-elsestatement for the result.Fibonacci Sequence:
Write a JavaScript program to print the firstnFibonacci numbers using aforloop. Use anif-elsecondition 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-elselogic.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 aswitchstatement 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-elsefor 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-elselogic.Nested Loops for a Pattern:
Write a JavaScript program that uses nestedforloops 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-elselogic 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-elsestatement 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 aswitchstatement. Use multiple cases (e.g., 1-10 for small, 11-20 for medium, etc.) for each category.
end of part 1 -------->
Explore Other Chapters