0% found this document useful (0 votes)
2 views

Practical 10

The document contains three JavaScript programs: one to display whether a number is even or odd, another to calculate the area of a circle based on the radius input, and a third to accept a number and display its square. Each program includes HTML structure and prompts for user input, with corresponding outputs demonstrated. The examples illustrate basic JavaScript functionalities such as conditional statements, arithmetic operations, and user interaction.

Uploaded by

yashkachi435
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Practical 10

The document contains three JavaScript programs: one to display whether a number is even or odd, another to calculate the area of a circle based on the radius input, and a third to accept a number and display its square. Each program includes HTML structure and prompts for user input, with corresponding outputs demonstrated. The examples illustrate basic JavaScript functionalities such as conditional statements, arithmetic operations, and user interaction.

Uploaded by

yashkachi435
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

*********practical 10 ****************

1)write a program using javascript To display even odd number.

evenodd.html

<!DOCTYPE html>

<head>

<title>To display even odd number

</title>

</head>

<body>

<script language="javascript">

var no;

no=prompt("Enter the number");

if(no%2==0)

document.write("number is even");

else

document.write("number is odd");

</script>

</body>

</html>

===========output===================

Enter the number=4

number is even
2)write a program using javascript To calculate area of circle.

area.html

<!DOCTYPE html>

<head>

<title>To calculate area of circle

</title>

</head>

<body>

<script language="javascript">

var r,area;

r=prompt("Enter radius of circle");

area=3.14*r*r;

document.write("<br>enter radius value:"+r);

document.write("<br>area of circle is:"+area);

</script>

</body>

</html>

============output===========

Enter radius of circle=3

enter radius value:3

area of circle is:28.259999999999998


3)write a program using javascript To accept number and display square of it.

<!DOCTYPE html>

<head>

<title>To accept number and display square of it.

</title>

</head>

<body>

<script language="javascript">

var a,b;

a=prompt("Enter any number");

b=a*a;

alert("square of"+a+"is"+b);

</script>

</body>

</html>

============output=================

Enter any number=2

square of :4

You might also like