0% found this document useful (0 votes)
2 views4 pages

JS Assignment 01

Uploaded by

adilnadeem0332
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views4 pages

JS Assignment 01

Uploaded by

adilnadeem0332
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

📘 JavaScript Assignment # 01 (Conditions

& Loops)
📌 Instructions for Students

• Use JavaScript only


• Take input using prompt()
• Display output using [Link]() or [Link]()
• Do not use arrays, functions, or advanced JS concepts
• Write clean and readable code with comments

1️⃣ Grade & Result System


Take marks from the user (0–100) and:

• Print grade according to marks


• Also print Pass or Fail

Grading rules:

• 90–100 → A
• 75–89 → B
• 60–74 → C
• 40–59 → D
• Below 40 → Fail

Must use if – else if – else

2️⃣ Largest and Smallest Number


Take three numbers from the user and find:

• The largest
• The smallest

Use if – else if – else only (no Math methods)

3️⃣ Smart Calculator


Take:

• Two numbers
• One operator (+, -, *, /)

Perform the operation and handle:

• Division by zero
• Invalid operator

Use if – else if – else

4️⃣ Multiplication Table Generator


Take a number from the user and print its multiplication table up to 10.

Must use a for loop

5️⃣ Sum Until Zero


Keep asking the user to enter numbers.

• Add all numbers


• Stop when user enters 0
• Display the final sum

Must use a while loop


6️⃣ Reverse Number Printing
Take a number N from the user and:

• Print numbers from N to 1

Use a while loop

7️⃣ Password Validation System

• Set a fixed password


• Ask the user to enter the password
• Keep asking until the correct password is entered
• Count and display number of attempts

Must use do–while loop

8️⃣ Even, Odd & Zero Counter


Take a number N from the user.

• From 1 to N, count:
o How many even
o How many odd
o Ignore zero

Use for loop + if–else

9️⃣ Prime Number Checker


Take a number from the user and check whether it is:

• Prime
• Not Prime

Use loop + condition

You might also like