P18CAI3201L

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

P18CAI3201L - UIDD Lab

Exercise -2 - Java Script Simple Exercise Programs

1. Get your name from the key board and print with different font style and font size and color.

2. Get your details (minimum 5 like name, dob, degree etc.) and print in separate line.

3. Write JS program for given number is ODD or EVEN.

<!DOCTYPE html>

<html>

<head>

<title>find odd or even</title>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<script>

function findOddEven(){

var num = document.getElementById('num').value;

if ( num % 2 == 0) {

document.getElementById('result').innerHTML = num + ' is a Even number';

}else{

document.getElementById('result').innerHTML = num + ' is a Odd number';

</script>

</head>

<body>
<h2>JavaScript to find Odd or Even number!</h2>

<form method="post">

Enter a number: <input type="number" id="num" name="num" min="0" /><input


type="button" value="Find Odd or Even" onclick="findOddEven()" name="find" />

<div style="margin-top: 10px;" id="result"></div>

</form>

</body>

</html>

4. Write JS program to find area of

a. Right angle triangle.

b. Sphere

c. Rectangle
5. Write JS program to print the biggest of two numbers.

6. Write JS program the given number is single digit or not.

7. Write JS program to convert the fahrenheit to celcius.

8. Write JS program to check the given year is leap year or not.

9. Write JS program to find volume of the cylinder


2.

You might also like