0% found this document useful (0 votes)
6 views3 pages

Practical 8

The document contains three JavaScript programs. The first program accepts two integers and displays the larger one, the second multiplies an integer by 3, and the third checks if a number is positive or negative. Each program includes HTML structure and sample outputs for user inputs.

Uploaded by

yashkachi435
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)
6 views3 pages

Practical 8

The document contains three JavaScript programs. The first program accepts two integers and displays the larger one, the second multiplies an integer by 3, and the third checks if a number is positive or negative. Each program includes HTML structure and sample outputs for user inputs.

Uploaded by

yashkachi435
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
You are on page 1/ 3

**********PRACTICAL 8 **************

1)Write a program using javascript To accept two integer and display large number of them.

large.html

<!DOCTYPE html>

<head>

<title>To accept two integer and display large number of them.

</title>

</head>

<body>

<script language="javascript">

var a,b;

a=prompt("Enter first value");

b=prompt("Enter second value");

if(a>b)

document.write("a is larger than b");

else

document.write("b is larger than a");

</script>

</body>

</html>

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

Enter first value=5

Enter second value=9

b is larger than a
2)write a program using javascript To accept integer and display the result multiplying it with 3.

multiply.html

<!DOCTYPE html>

<head>

<title>To accept integer and display the result multiplying it with 3

</title>

</head>

<body>

<script language="javascript">

var a,no,ans;

a=prompt("Enter any value");

no=parseInt(a);

ans=no*3;

document.write("The answer is:"+ans);

</script>

</body>

</html>

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

Enter any value=4

The answer is:12


3)write a program using javascript To check no. is positive or negative.

<!DOCTYPE html>

<head>

<title>To check no. is positive or negative

</title>

</head>

<body>

<script language="javascript">

var a,no;

a=prompt("Enter any no");

no=parseInt(a);

if(no>0)

document.write("Number is Positive");

else

document.write("Number is Negative");

</script>

</body>

</html>

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

Enter any no=4

Number is Positive

Enter any no= -6

Number is Negative

You might also like