Lab 1

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Lab 1

1. Check if a number is odd or even in JavaScript


2. Check if the number is positive or negative/zero
3. Check if input variable is a number or not (hint use isNaN() )
4. Find the largest of two number
5. Find the largest of three number using function with return.
6. Check if a triangle is equilateral, scalene, or isosceles
7. Find check if a year is leap year or not
8. Find the grade for input marks
9. Perform arithmetic operations on two numbers
10.Program to print weekday based on given number
11.Write a program in Javascript to Display a your name five times.
12.Write a program in Javascript to display Numbers from 1 to 5.
13.Write a program in Javascript to display sum of any given natural numbers.
14.Write in JavaScript for loop that will iterate from 0 to 15. For each iteration,
it will check if the current number is odd or even, and display a message to
the screen.
Sample Output :
"0 is even"
"1 is odd"
"2 is even
15.Write to using loop to find factorial of number . (take input number from
user)
16.Write in javascript using Switch case statement to find the grade of the
students by taking marks from user. ( 90-100 grade A+, 80 -90 grade A, 70 -
80 grade B+ , 60-70 grade B, 50-60 grade C,less 50 grade D.
17.Write a Program in Javascript to take an input from the user and check
whether it is a prime number or not then show a message in the alert box.
18.Write a program in javascript to create a web form that contains a textbox
for name , email, and password. When a form is submitted, check a every
field is filled or not if not show required error message. If there is no error
then show all the collected information in the alert box.

You might also like